summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-07-21 04:13:31 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2019-07-21 04:38:17 +0200
commit4f60daa29568a43ab1da761d89124308dc7b37e7 (patch)
tree404deda1d4c5534f02b5a79348637ca568d6f3e0
parentb9cb7d57fdea7246f536204fd0f267380434aa09 (diff)
Docker: Decoupled nginx and fpm builds
-rw-r--r--.gitlab-ci.yml11
-rw-r--r--README.md2
-rw-r--r--contrib/Dockerfile7
3 files changed, 11 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index db26ce4c..7b0a8043 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,15 +30,23 @@ stages:
build-image.nginx:
<<: *docker_definition
stage: build-frontend
+ artifacts:
+ name: "${CI_JOB_NAME}_${CI_JOB_ID}_assets"
+ expire_in: 1 day
+ paths:
+ - ./public/assets
script:
- docker build --pull -t "${TEST_IMAGE}-nginx" -f contrib/nginx/Dockerfile .
- docker push "${TEST_IMAGE}-nginx"
+ - instance=$(docker create "${TEST_IMAGE}-nginx")
+ - docker cp "${instance}:/var/www/public/assets" public/
+ - docker rm "${instance}"
build-image:
<<: *docker_definition
stage: build
script:
- - docker build --pull --build-arg NGINX_IMAGE="${TEST_IMAGE}-nginx" -t "${TEST_IMAGE}" -f contrib/Dockerfile .
+ - docker build --pull -t "${TEST_IMAGE}" -f contrib/Dockerfile .
- docker push "${TEST_IMAGE}"
test:
@@ -112,6 +120,7 @@ build-release-file:
- ./release/
script:
- rsync -vAax "${DOCROOT}" release/
+ - rsync -vAax public/assets release/public/
deploy-staging:
<<: *deploy_definition
diff --git a/README.md b/README.md
index db62c6e5..ce47ef6a 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@ vendor/bin/phpunit
### CI & Build Pipeline
The engelsystem can be tested and automatically deployed to a testing/staging/production environment.
-This functionality requires a [GitLab](https://about.gitlab.com/) server with a running docker minion.
+This functionality requires a [GitLab](https://about.gitlab.com/) server with a working docker runner.
To use the deployment features the following secret variables need to be defined (if undefined the step will be skipped):
```bash
diff --git a/contrib/Dockerfile b/contrib/Dockerfile
index dd3bd308..00e21689 100644
--- a/contrib/Dockerfile
+++ b/contrib/Dockerfile
@@ -1,15 +1,9 @@
-# Setup
-ARG NGINX_IMAGE=engelsystem-nginx:latest
-
# composer install
FROM composer AS composer
COPY ./ /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
COPY bin/ /app/bin
@@ -18,7 +12,6 @@ COPY db/ /app/db
COPY import/ /app/import
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