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/
|
||||
|
||||
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
|
||||
|
|
|
@ -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,\
|
||||
|
|
|
@ -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/
|
||||
|
|
Loading…
Reference in New Issue