From 590adffa9316b98544cb8d67b03b80e44ba9c8b7 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 23 Sep 2018 14:18:24 +0200 Subject: [PATCH] Fixed release file build (did not include frontend files), formatting --- .gitlab-ci.yml | 17 +++++++++-------- README.md | 2 +- composer.json | 1 - contrib/Dockerfile | 8 ++++++++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a599a6dc..2d7f3cf4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ variables: DOCROOT: /var/www/ stages: + - build-frontend - build - test - release @@ -26,20 +27,20 @@ stages: before_script: - docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}" +build-image.nginx: + <<: *docker_definition + stage: build-frontend + script: + - docker build --pull -t "${TEST_IMAGE}-nginx" -f contrib/nginx/Dockerfile . + - docker push "${TEST_IMAGE}-nginx" + build-image: <<: *docker_definition stage: build script: - - docker build --pull -t "${TEST_IMAGE}" -f contrib/Dockerfile . + - docker build --pull --build-arg NGINX_IMAGE="${TEST_IMAGE}-nginx" -t "${TEST_IMAGE}" -f contrib/Dockerfile . - docker push "${TEST_IMAGE}" -build-image.nginx: - <<: *docker_definition - stage: build - script: - - docker build --pull -t "${TEST_IMAGE}.nginx" -f contrib/nginx/Dockerfile . - - docker push "${TEST_IMAGE}.nginx" - test: image: ${TEST_IMAGE} stage: test diff --git a/README.md b/README.md index f564c71d..c3a650c9 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ docker-compose build or to build the containers separately ```bash -docker build -f contrib/Dockerfile . -t engelsystem docker build -f contrib/nginx/Dockerfile . -t engelsystem-nginx +docker build -f contrib/Dockerfile . -t engelsystem ``` Import database diff --git a/composer.json b/composer.json index 10e34804..622fbdfa 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,6 @@ "psr/log": "^1.0", "symfony/http-foundation": "^3.3", "symfony/psr-http-message-bridge": "^1.0", - "twbs/bootstrap": "^3.3", "twig/extensions": "^1.5", "twig/twig": "^2.5", "zendframework/zend-diactoros": "^1.7" diff --git a/contrib/Dockerfile b/contrib/Dockerfile index 5d40bafb..665fb426 100644 --- a/contrib/Dockerfile +++ b/contrib/Dockerfile @@ -1,8 +1,14 @@ +# Setup +ARG NGINX_IMAGE=engelsystem-nginx:latest + +# composer install FROM composer AS composer COPY composer.json /app/ RUN composer --no-ansi install --no-dev --ignore-platform-reqs RUN composer --no-ansi dump-autoload --optimize +# Use frontend container for assets +FROM ${NGINX_IMAGE} AS frontend # Intermediate container for less layers FROM alpine as data @@ -11,6 +17,7 @@ COPY config/ /app/config COPY db/ /app/db COPY includes/ /app/includes COPY public/ /app/public +COPY --from=frontend /var/www/public/assets/ /app/public/assets COPY resources/lang /app/resources/lang COPY resources/views /app/resources/views COPY src/ /app/src @@ -22,6 +29,7 @@ COPY --from=composer /app/composer.lock /app/ RUN rm -f /app/config/config.php +# Build the PHP container FROM php:7-fpm-alpine WORKDIR /var/www COPY --from=data /app/ /var/www