Docker/Release: Add more state files, improved Dockerfiles
This commit is contained in:
parent
aa11bead7c
commit
c7deeb9368
|
@ -12,7 +12,6 @@ variables:
|
||||||
DOCROOT: /var/www/
|
DOCROOT: /var/www/
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build-frontend
|
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
|
@ -29,17 +28,19 @@ stages:
|
||||||
|
|
||||||
build-image.nginx:
|
build-image.nginx:
|
||||||
<<: *docker_definition
|
<<: *docker_definition
|
||||||
stage: build-frontend
|
stage: build
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "${CI_JOB_NAME}_${CI_JOB_ID}_assets"
|
name: "${CI_JOB_NAME}_${CI_JOB_ID}_assets"
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
paths:
|
paths:
|
||||||
- ./public/assets
|
- ./public/assets
|
||||||
|
- ./yarn.lock
|
||||||
script:
|
script:
|
||||||
- docker build --pull -t "${TEST_IMAGE}-nginx" -f contrib/nginx/Dockerfile .
|
- docker build --pull -t "${TEST_IMAGE}-nginx" -f contrib/nginx/Dockerfile .
|
||||||
- docker push "${TEST_IMAGE}-nginx"
|
- docker push "${TEST_IMAGE}-nginx"
|
||||||
- instance=$(docker create "${TEST_IMAGE}-nginx")
|
- instance=$(docker create "${TEST_IMAGE}-nginx")
|
||||||
- docker cp "${instance}:/var/www/public/assets" public/
|
- docker cp "${instance}:/var/www/public/assets" public/
|
||||||
|
- docker cp "${instance}:/var/www/yarn.lock" .
|
||||||
- docker rm "${instance}"
|
- docker rm "${instance}"
|
||||||
|
|
||||||
build-image:
|
build-image:
|
||||||
|
@ -121,8 +122,9 @@ build-release-file:
|
||||||
paths:
|
paths:
|
||||||
- ./release/
|
- ./release/
|
||||||
script:
|
script:
|
||||||
- rsync -vAax "${DOCROOT}" release/
|
- rsync -vAax "${DOCROOT}" "${DOCROOT}/.babelrc" "${DOCROOT}/.browserslistrc" release/
|
||||||
- rsync -vAax public/assets release/public/
|
- rsync -vAax public/assets release/public/
|
||||||
|
- rsync -vAax yarn.lock release/
|
||||||
|
|
||||||
deploy-staging:
|
deploy-staging:
|
||||||
<<: *deploy_definition
|
<<: *deploy_definition
|
||||||
|
|
|
@ -6,10 +6,11 @@ RUN composer --no-ansi dump-autoload --optimize
|
||||||
|
|
||||||
# Intermediate container for less layers
|
# Intermediate container for less layers
|
||||||
FROM alpine as data
|
FROM alpine as data
|
||||||
|
COPY .babelrc .browserslistrc composer.json LICENSE package.json README.md webpack.config.js /app/
|
||||||
COPY bin/ /app/bin
|
COPY bin/ /app/bin
|
||||||
COPY config/ /app/config
|
COPY config/ /app/config
|
||||||
COPY db/ /app/db
|
COPY db/ /app/db
|
||||||
COPY import/ /app/import
|
RUN mkdir /app/import/
|
||||||
COPY includes/ /app/includes
|
COPY includes/ /app/includes
|
||||||
COPY public/ /app/public
|
COPY public/ /app/public
|
||||||
COPY resources/lang /app/resources/lang
|
COPY resources/lang /app/resources/lang
|
||||||
|
@ -17,16 +18,11 @@ COPY resources/views /app/resources/views
|
||||||
COPY src/ /app/src
|
COPY src/ /app/src
|
||||||
COPY storage/ /app/storage
|
COPY storage/ /app/storage
|
||||||
|
|
||||||
COPY composer.json LICENSE package.json README.md /app/
|
|
||||||
|
|
||||||
COPY --from=composer /app/vendor/ /app/vendor
|
COPY --from=composer /app/vendor/ /app/vendor
|
||||||
COPY --from=composer /app/composer.lock /app/
|
COPY --from=composer /app/composer.lock /app/
|
||||||
|
|
||||||
RUN find /app/storage/ -type f -not -name .gitignore -exec rm {} \;
|
RUN find /app/storage/ -type f -not -name .gitignore -exec rm {} \;
|
||||||
RUN rm -f /app/import/* /app/config/config.php
|
RUN rm -f /app/config/config.php
|
||||||
|
|
||||||
ARG VERSION
|
|
||||||
RUN if [[ ! -f /app/storage/app/VERSION ]] && [[ ! -z "${VERSION}" ]]; then echo -n "${VERSION}" > /app/storage/app/VERSION; fi
|
|
||||||
|
|
||||||
# Build the PHP container
|
# Build the PHP container
|
||||||
FROM php:7-fpm-alpine
|
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/ && \
|
RUN chown -R www-data:www-data /var/www/import/ /var/www/storage/ && \
|
||||||
rm -r /var/www/html
|
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,\
|
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,\
|
127.0.0.0/8,::ffff:127.0.0.0/8,\
|
||||||
172.16.0.0/12,::ffff:172.16.0.0/12,\
|
172.16.0.0/12,::ffff:172.16.0.0/12,\
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
FROM node:8-alpine as themes
|
FROM node:8-alpine as themes
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache yarn
|
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
|
RUN yarn install
|
||||||
COPY resources/assets/ /app/resources/assets
|
COPY resources/assets/ /app/resources/assets
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM nginx:alpine
|
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 contrib/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY --from=themes /app/public/assets /var/www/public/assets/
|
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/
|
||||||
|
|
Loading…
Reference in New Issue