Assets are only needed by nginx - not php

This commit is contained in:
marudor 2018-09-20 13:14:45 +02:00 committed by msquare
parent 2a134e6c0b
commit 41399fb9d9
3 changed files with 14 additions and 17 deletions

View File

@ -3,13 +3,6 @@ COPY composer.json /app/
RUN composer --no-ansi install --no-dev --ignore-platform-reqs RUN composer --no-ansi install --no-dev --ignore-platform-reqs
RUN composer --no-ansi dump-autoload --optimize RUN composer --no-ansi dump-autoload --optimize
FROM node:8-alpine as themes
WORKDIR /app
COPY resources/assets/ /app/resources/assets
COPY .babelrc package.json webpack.config.js /app/
RUN apk add --no-cache yarn
RUN yarn install
RUN yarn build
# Intermediate container for less layers # Intermediate container for less layers
FROM alpine as data FROM alpine as data
@ -18,7 +11,8 @@ COPY config/ /app/config
COPY db/ /app/db COPY db/ /app/db
COPY includes/ /app/includes COPY includes/ /app/includes
COPY public/ /app/public COPY public/ /app/public
COPY resources/ /app/resources COPY resources/lang /app/resources/lang
COPY resources/views /app/resources/views
COPY src/ /app/src COPY src/ /app/src
COPY composer.json LICENSE package.json README.md /app/ COPY composer.json LICENSE package.json README.md /app/
@ -26,17 +20,13 @@ COPY composer.json LICENSE package.json README.md /app/
COPY --from=composer /app/vendor/ /app/vendor COPY --from=composer /app/vendor/ /app/vendor
COPY --from=composer /app/composer.lock /app/ COPY --from=composer /app/composer.lock /app/
COPY --from=themes /app/public/assets /app/public/assets
COPY --from=themes /app/yarn.lock /app/
RUN rm -f /app/config/config.php RUN rm -f /app/config/config.php
FROM php:7-fpm-alpine FROM php:7-fpm-alpine
WORKDIR /var/www WORKDIR /var/www
COPY --from=data /app/ /var/www COPY --from=data /app/ /var/www
RUN apk add --no-cache icu-dev gettext-dev && \ RUN apk add --no-cache icu-dev gettext-dev && \
docker-php-ext-install intl gettext pdo_mysql && \ docker-php-ext-install intl gettext pdo_mysql
rm -r /var/www/html
ENV TRUSTED_PROXIES 10.0.0.0/8,::ffff:10.0.0.0/8,\ ENV TRUSTED_PROXIES 10.0.0.0/8,::ffff:10.0.0.0/8,\
127.0.0.0/8,::ffff:127.0.0.0/8,\ 127.0.0.0/8,::ffff:127.0.0.0/8,\

View File

@ -7,8 +7,6 @@ services:
dockerfile: contrib/nginx/Dockerfile dockerfile: contrib/nginx/Dockerfile
ports: ports:
- 5000:80 - 5000:80
volumes:
- static:/var/www/html
networks: networks:
- internal - internal
depends_on: depends_on:
@ -23,8 +21,6 @@ services:
MYSQL_USER: engelsystem MYSQL_USER: engelsystem
MYSQL_PASSWORD: engelsystem MYSQL_PASSWORD: engelsystem
MYSQL_DATABASE: engelsystem MYSQL_DATABASE: engelsystem
volumes:
- static:/var/www/html
networks: networks:
- internal - internal
- database - database

View File

@ -1,2 +1,13 @@
FROM node:8-alpine as themes
WORKDIR /app
COPY resources/assets/ /app/resources/assets
COPY .babelrc package.json webpack.config.js /app/
RUN apk add --no-cache yarn
RUN yarn install
RUN yarn build
FROM nginx:alpine FROM nginx:alpine
COPY contrib/nginx/nginx.conf /etc/nginx/nginx.conf COPY contrib/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=themes /app/public/assets /var/www/public/assets/
COPY public/.htaccess /var/www/public/
COPY public/index.php /var/www/public/