summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2019-07-28 18:48:58 +0200
committerGitHub <noreply@github.com>2019-07-28 18:48:58 +0200
commit1da69bebd9687dd415df591f7dd43803898ead9e (patch)
treeb8c8e6e178e31ba86b7dcff497697c9bdc16258c
parentaa11bead7cff72daa2ce71a03701d6d2875d7ec4 (diff)
parentc7deeb9368a6dad4e60ab80d0d7a98713d31a8b9 (diff)
Merge pull request #629 from MyIgel/docker-improvements
Docker/Release: Add more state files, improved Dockerfiles
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--contrib/Dockerfile13
-rw-r--r--contrib/nginx/Dockerfile5
3 files changed, 14 insertions, 12 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2b044e56..4724da5a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,7 +12,6 @@ variables:
DOCROOT: /var/www/
stages:
- - build-frontend
- build
- test
- release
@@ -29,17 +28,19 @@ stages:
build-image.nginx:
<<: *docker_definition
- stage: build-frontend
+ stage: build
artifacts:
name: "${CI_JOB_NAME}_${CI_JOB_ID}_assets"
expire_in: 1 day
paths:
- ./public/assets
+ - ./yarn.lock
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 cp "${instance}:/var/www/yarn.lock" .
- docker rm "${instance}"
build-image:
@@ -121,8 +122,9 @@ build-release-file:
paths:
- ./release/
script:
- - rsync -vAax "${DOCROOT}" release/
+ - rsync -vAax "${DOCROOT}" "${DOCROOT}/.babelrc" "${DOCROOT}/.browserslistrc" release/
- rsync -vAax public/assets release/public/
+ - rsync -vAax yarn.lock release/
deploy-staging:
<<: *deploy_definition
diff --git a/contrib/Dockerfile b/contrib/Dockerfile
index be6818fe..0e5e389f 100644
--- a/contrib/Dockerfile
+++ b/contrib/Dockerfile
@@ -6,10 +6,11 @@ RUN composer --no-ansi dump-autoload --optimize
# Intermediate container for less layers
FROM alpine as data
+COPY .babelrc .browserslistrc composer.json LICENSE package.json README.md webpack.config.js /app/
COPY bin/ /app/bin
COPY config/ /app/config
COPY db/ /app/db
-COPY import/ /app/import
+RUN mkdir /app/import/
COPY includes/ /app/includes
COPY public/ /app/public
COPY resources/lang /app/resources/lang
@@ -17,16 +18,11 @@ COPY resources/views /app/resources/views
COPY src/ /app/src
COPY storage/ /app/storage
-COPY composer.json LICENSE package.json README.md /app/
-
COPY --from=composer /app/vendor/ /app/vendor
COPY --from=composer /app/composer.lock /app/
RUN find /app/storage/ -type f -not -name .gitignore -exec rm {} \;
-RUN rm -f /app/import/* /app/config/config.php
-
-ARG VERSION
-RUN if [[ ! -f /app/storage/app/VERSION ]] && [[ ! -z "${VERSION}" ]]; then echo -n "${VERSION}" > /app/storage/app/VERSION; fi
+RUN rm -f /app/config/config.php
# Build the PHP container
FROM php:7-fpm-alpine
@@ -37,6 +33,9 @@ COPY --from=data /app/ /var/www
RUN chown -R www-data:www-data /var/www/import/ /var/www/storage/ && \
rm -r /var/www/html
+ARG VERSION
+RUN if [[ ! -f /var/www/storage/app/VERSION ]] && [[ ! -z "${VERSION}" ]]; then echo -n "${VERSION}" > /var/www/storage/app/VERSION; fi
+
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,\
172.16.0.0/12,::ffff:172.16.0.0/12,\
diff --git a/contrib/nginx/Dockerfile b/contrib/nginx/Dockerfile
index 74907326..3fe424aa 100644
--- a/contrib/nginx/Dockerfile
+++ b/contrib/nginx/Dockerfile
@@ -1,12 +1,13 @@
FROM node:8-alpine as themes
WORKDIR /app
RUN apk add --no-cache yarn
-COPY .babelrc package.json webpack.config.js /app/
+COPY .babelrc .browserslistrc package.json webpack.config.js /app/
RUN yarn install
COPY resources/assets/ /app/resources/assets
RUN yarn build
FROM nginx:alpine
+RUN mkdir -p /var/www/public/ && touch /var/www/public/index.php
COPY contrib/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=themes /app/public/assets /var/www/public/assets/
-RUN touch /var/www/public/index.php
+COPY --from=themes /app/yarn.lock /var/www/