summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml15
-rw-r--r--README.md2
-rw-r--r--composer.json1
-rw-r--r--contrib/Dockerfile8
4 files changed, 17 insertions, 9 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,19 +27,19 @@ stages:
before_script:
- docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}"
-build-image:
+build-image.nginx:
<<: *docker_definition
- stage: build
+ stage: build-frontend
script:
- - docker build --pull -t "${TEST_IMAGE}" -f contrib/Dockerfile .
- - docker push "${TEST_IMAGE}"
+ - docker build --pull -t "${TEST_IMAGE}-nginx" -f contrib/nginx/Dockerfile .
+ - docker push "${TEST_IMAGE}-nginx"
-build-image.nginx:
+build-image:
<<: *docker_definition
stage: build
script:
- - docker build --pull -t "${TEST_IMAGE}.nginx" -f contrib/nginx/Dockerfile .
- - docker push "${TEST_IMAGE}.nginx"
+ - docker build --pull --build-arg NGINX_IMAGE="${TEST_IMAGE}-nginx" -t "${TEST_IMAGE}" -f contrib/Dockerfile .
+ - docker push "${TEST_IMAGE}"
test:
image: ${TEST_IMAGE}
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