From 41399fb9d91d29a18e4e42e5d16a72f19c325ece Mon Sep 17 00:00:00 2001 From: marudor Date: Thu, 20 Sep 2018 13:14:45 +0200 Subject: [PATCH] Assets are only needed by nginx - not php --- contrib/Dockerfile | 16 +++------------- contrib/docker-compose.yml | 4 ---- contrib/nginx/Dockerfile | 11 +++++++++++ 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/contrib/Dockerfile b/contrib/Dockerfile index a47c935f..520e1216 100644 --- a/contrib/Dockerfile +++ b/contrib/Dockerfile @@ -3,13 +3,6 @@ COPY composer.json /app/ RUN composer --no-ansi install --no-dev --ignore-platform-reqs 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 FROM alpine as data @@ -18,7 +11,8 @@ COPY config/ /app/config COPY db/ /app/db COPY includes/ /app/includes 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 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/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 FROM php:7-fpm-alpine WORKDIR /var/www COPY --from=data /app/ /var/www RUN apk add --no-cache icu-dev gettext-dev && \ - docker-php-ext-install intl gettext pdo_mysql && \ - rm -r /var/www/html + docker-php-ext-install intl gettext pdo_mysql 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,\ diff --git a/contrib/docker-compose.yml b/contrib/docker-compose.yml index 1dbb7e81..b1dab793 100644 --- a/contrib/docker-compose.yml +++ b/contrib/docker-compose.yml @@ -7,8 +7,6 @@ services: dockerfile: contrib/nginx/Dockerfile ports: - 5000:80 - volumes: - - static:/var/www/html networks: - internal depends_on: @@ -23,8 +21,6 @@ services: MYSQL_USER: engelsystem MYSQL_PASSWORD: engelsystem MYSQL_DATABASE: engelsystem - volumes: - - static:/var/www/html networks: - internal - database diff --git a/contrib/nginx/Dockerfile b/contrib/nginx/Dockerfile index a06ea3e7..3cda7c17 100644 --- a/contrib/nginx/Dockerfile +++ b/contrib/nginx/Dockerfile @@ -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 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/