-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (35 loc) · 1.32 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
41
42
43
44
45
46
47
# composer
FROM composer:latest as vendor
COPY composer.json composer.lock ./
COPY database/ database/
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist \
--no-dev
# build css & js
FROM node:current-alpine as frontend
RUN mkdir -p ./public/css ./public/js
COPY package.json package-lock.json webpack.mix.js .babelrc .env ./
COPY resources/ resources/
RUN npm install --production && npm run prod
# php
FROM php:7-fpm-alpine
COPY . /var/www/html
RUN rm /var/www/html/bootstrap/cache/*
COPY --from=vendor /app/vendor/ /var/www/html/vendor/
COPY --from=frontend /public/js/ /var/www/html/public/js/
COPY --from=frontend /public/css/ /var/www/html/public/css/
# change uid and gid for www-data user (alpine)
RUN apk --no-cache add shadow && \
usermod -u 1000 www-data && \
groupmod -g 1000 www-data
WORKDIR /var/www/html
RUN /usr/local/bin/php /var/www/html/artisan config:clear
RUN /usr/local/bin/php /var/www/html/artisan view:clear
RUN /usr/local/bin/php /var/www/html/artisan cache:clear
RUN /usr/local/bin/php /var/www/html/artisan route:cache
RUN /usr/local/bin/php /var/www/html/artisan config:cache
RUN chgrp -R www-data /var/www/html/storage /var/www/html/bootstrap/cache && chmod -R ug+rwx /var/www/html/storage /var/www/html/bootstrap/cache