-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (28 loc) · 1.02 KB
/
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
33
34
35
36
37
38
39
40
FROM composer
LABEL version=v1.0.1
LABEL app=CyberShop
# Create the web directory to serve the app
RUN mkdir -p /var/www/html
WORKDIR /var/www/html/
# Copy all the files from the git repo to the container
COPY . .
# Create the php ini config file and install the extensions dependencies
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
RUN docker-php-ext-install pdo_mysql
# Update and install the laravel deps
RUN composer update && composer install --no-dev
# Publish the storage directory
RUN php artisan storage:link
# Install deps for the wait-for-mysql script
RUN apk add mariadb-client && apk cache clean
RUN mv wait-for-mysql.sh /
# Ensure that the MySQL container is started and launch migration
# Serve the API
# Serve the app
RUN echo "/wait-for-mysql.sh" > /init.sh \
&& echo "php artisan serve --host 0.0.0.0 --port 8000&" >> /init.sh \
&& echo "php artisan serve --host 0.0.0.0 --port 80" >> /init.sh
RUN chmod +x /wait-for-mysql.sh \
&& chmod +x /init.sh
# Launch it
CMD ["/init.sh"]