added streamline docker compose and build steps
This commit is contained in:
parent
7a99a44307
commit
f6d57ef83b
2 changed files with 127 additions and 0 deletions
|
|
@ -316,3 +316,97 @@ deploy:development:
|
||||||
- docker stack deploy --with-registry-auth -c docker-compose.dev.yml webui
|
- docker stack deploy --with-registry-auth -c docker-compose.dev.yml webui
|
||||||
when: manual
|
when: manual
|
||||||
allow_failure: false
|
allow_failure: false
|
||||||
|
|
||||||
|
dependencies:streamline:
|
||||||
|
image: node:$NODE_VERSION
|
||||||
|
stage: dependencies
|
||||||
|
only:
|
||||||
|
refs:
|
||||||
|
- streamline
|
||||||
|
# before_script:
|
||||||
|
# - npm -g config set user root
|
||||||
|
script:
|
||||||
|
- npm ci
|
||||||
|
cache:
|
||||||
|
key:
|
||||||
|
files:
|
||||||
|
- package-lock.json
|
||||||
|
paths:
|
||||||
|
- node_modules
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 hour
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
|
||||||
|
# test:
|
||||||
|
# image: node:$NODE_VERSION
|
||||||
|
# stage: setup
|
||||||
|
# dependencies:
|
||||||
|
# - dependencies:production
|
||||||
|
# only:
|
||||||
|
# - master
|
||||||
|
# before_script:
|
||||||
|
# - npm run lint
|
||||||
|
# script:
|
||||||
|
# - CI=true npm run test
|
||||||
|
|
||||||
|
setup:streamline:
|
||||||
|
image: node:$NODE_VERSION
|
||||||
|
stage: setup
|
||||||
|
dependencies:
|
||||||
|
- dependencies:streamline
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
script:
|
||||||
|
- npm run build:streamline
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 hour
|
||||||
|
paths:
|
||||||
|
- build
|
||||||
|
|
||||||
|
build:streamline:
|
||||||
|
image: docker:20.10.21
|
||||||
|
stage: build
|
||||||
|
dependencies:
|
||||||
|
- setup:streamline
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
services:
|
||||||
|
- docker:20.10.21-dind
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
before_script:
|
||||||
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
|
||||||
|
script:
|
||||||
|
- docker build -t ${CI_REGISTRY}/brandx/bxt-app/streamline:${CI_COMMIT_SHA} .
|
||||||
|
- docker tag ${CI_REGISTRY}/brandx/bxt-app/streamline:${CI_COMMIT_SHA} ${CI_REGISTRY}/brandx/bxt-app/production:latest
|
||||||
|
- docker push ${CI_REGISTRY}/brandx/bxt-app/streamline
|
||||||
|
|
||||||
|
deploy:streamline:
|
||||||
|
image: docker:20.10.21
|
||||||
|
stage: deploy
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
DOCKER_HOST: ssh://deploy@streamline.adaptiveagriculture.ca
|
||||||
|
DEPLOY_IMAGE: ${CI_REGISTRY}/brandx/bxt-app/streamline:latest
|
||||||
|
DEPLOY_TARGET: deploy@streamline.adaptiveagriculture.ca
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
environment:
|
||||||
|
name: Streamline
|
||||||
|
url: https://streamline.adaptiveagriculture.ca
|
||||||
|
before_script: &deploy_tunnel
|
||||||
|
- "apk --update add openssh-client"
|
||||||
|
- "eval $(ssh-agent -s)"
|
||||||
|
- "echo \"$DEPLOY_SSH_PRIV_KEY\" | tr -d '\r' | ssh-add - > /dev/null"
|
||||||
|
# - "ssh -Mo StrictHostKeyChecking=no -S deploy-ctrl-socket -fnNTL /var/run/docker.sock:/var/run/docker.sock ${DEPLOY_TARGET}"
|
||||||
|
# - "ssh -S deploy-ctrl-socket -O check ${DEPLOY_TARGET}"
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- chmod 700 ~/.ssh
|
||||||
|
- ssh -o StrictHostKeyChecking=no ${DEPLOY_TARGET}
|
||||||
|
script:
|
||||||
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
|
||||||
|
- docker stack deploy --with-registry-auth -c docker-compose.streamline.yml webui
|
||||||
|
when: manual
|
||||||
|
allow_failure: false
|
||||||
33
docker-compose.streamline.yml
Normal file
33
docker-compose.streamline.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
version: "3.6"
|
||||||
|
|
||||||
|
services:
|
||||||
|
webui:
|
||||||
|
image: ${DEPLOY_IMAGE}
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
stop_signal: SIGQUIT
|
||||||
|
deploy:
|
||||||
|
update_config:
|
||||||
|
order: start-first
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "localhost:8080/health"]
|
||||||
|
interval: 1m
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
|
labels:
|
||||||
|
com.datadoghq.ad.logs: '[{"source": "nginx", "service": "webui"}]'
|
||||||
|
traefik.docker.network: "backend"
|
||||||
|
traefik.enable: "true"
|
||||||
|
traefik.http.routers.webui.rule: "Host(`streamline.adaptiveagriculture.ca`)"
|
||||||
|
traefik.frontend.redirect.regex: "^https?://streamline.adaptiveagriculture.ca/(.*)"
|
||||||
|
traefik.frontend.redirect.replacement: "https://streamline.adaptiveagriculture.ca/$${1}"
|
||||||
|
traefik.backend: "www"
|
||||||
|
traefik.http.services.webui.loadbalancer.server.port: "80"
|
||||||
|
traefik.protocol: "http"
|
||||||
|
dns:
|
||||||
|
- 69.27.101.6
|
||||||
|
|
||||||
|
networks:
|
||||||
|
backend:
|
||||||
|
external: true
|
||||||
Loading…
Add table
Add a link
Reference in a new issue