build(docker): switch to multistage build image
This commit is contained in:
parent
9d3505d299
commit
7d94c70adc
2 changed files with 19 additions and 8 deletions
|
|
@ -1,5 +1,20 @@
|
|||
ARG SITE=signpost.cloud.mareshq.com
|
||||
|
||||
FROM node:lts as builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY ./sites/${SITE}/package.json .
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
COPY ./sites/${SITE} .
|
||||
|
||||
RUN yarn build
|
||||
|
||||
# Final image
|
||||
FROM nginx:mainline-alpine as nginx
|
||||
|
||||
COPY ./../../build/nginx/site.conf /etc/nginx/conf.d/default.conf
|
||||
COPY ./build/nginx/site.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY ./out /var/www/html
|
||||
COPY --from=builder /build/out /var/www/html
|
||||
|
|
|
|||
|
|
@ -11,20 +11,16 @@ variables:
|
|||
|
||||
build:
|
||||
stage: build
|
||||
image: sikalabs/ci-node
|
||||
before_script:
|
||||
- docker info
|
||||
script:
|
||||
- cd sites/signpost.cloud.mareshq.com
|
||||
- yarn install --frozen-lockfile
|
||||
- yarn build
|
||||
- docker build --tag $IMAGE:$IMAGE_TAG --file ./../../build/Containerfile .
|
||||
- docker build --tag $IMAGE:$IMAGE_TAG --file ./../../build/Containerfile --build-arg SITE=signpost.cloud.mareshq.com .
|
||||
- docker push $IMAGE:$IMAGE_TAG
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- helm upgrade --install signpost-cloud-mareshq-com ./deploy/charts/static-site --namespace internal-static-sites -f ./sites/signpost.cloud.mareshq.com/helm-values.yaml --set image.tag=${CI_COMMIT_BRANCH}-${CI_COMMIT_SHORT_SHA}
|
||||
- helm upgrade --install signpost-cloud-mareshq-com ./deploy/charts/static-site --namespace internal-static-sites -f ./sites/signpost.cloud.mareshq.com/helm-values.yaml --set image.tag=${CI_COMMIT_BRANCH}-${CI_COMMIT_SHORT_SHA} --set image.pullSecretBase64=$REGISTRY_PULL_SECRET_BASE64
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
environment:
|
||||
|
|
|
|||
Reference in a new issue