-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
34 lines (22 loc) · 825 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM php:8.2-cli
LABEL version=1.0.1
LABEL app=Chat.php
# Set the working directory to /var/www/html
WORKDIR /var/www/html/
# Copy all files from the github repo to the container
COPY . .
RUN mv schema.sql wait-for-mysql.sh /
# Configure PHP needed extensions (dependencies)
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
RUN docker-php-ext-install pdo_mysql
# Install the mariadb client to run the migration and clean the apt cache
RUN apt update \
&& apt install mariadb-client -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists
# Expose the HTTP port
EXPOSE 80
# Ensure that the MySQL container is started, launch migration, and launch the HTTP server
RUN echo "/wait-for-mysql.sh \nphp -S 0.0.0.0:80" > /init.sh
RUN chmod +x /wait-for-mysql.sh && chmod +x /init.sh
CMD ["/init.sh"]