-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
44 lines (39 loc) · 1.4 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
variables:
CI_DEBUG_SERVICES: "true"
before_script:
- apk update
- apk --no-cache add py3-pip python3 curl
- pip3 install pyyaml --break-system-packages
- curl -O https://raw.githubusercontent.com/FredHutch/swarm-build-helper/main/build_helper.py
# below is from https://stackoverflow.com/a/65810302/470769
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
- set -x
stages:
- build
- test
- deploy
build:
stage: build
script:
- docker build -t sc-registry.fredhutch.org/itn-dashboard:test .
- docker push sc-registry.fredhutch.org/itn-dashboard:test
test:
stage: test
services:
- name: sc-registry.fredhutch.org/itn-dashboard:test
alias: itn-dashboard
script:
- sleep 15 && curl -sI http://itn-dashboard:3838 |head -1|grep -q "200 OK"
deploy:
stage: deploy
only:
refs:
- main
script:
- docker tag sc-registry.fredhutch.org/itn-dashboard:test sc-registry.fredhutch.org/itn-dashboard:latest
- docker push sc-registry.fredhutch.org/itn-dashboard:latest
- sleep 15
- echo $SC_SWARM_CICD_SSH_KEY | base64 -d > ./sc_swarm_cicd_ssh_key
- chmod 0400 ./sc_swarm_cicd_ssh_key
- python3 build_helper.py docker-compose.yml | ssh -i ./sc_swarm_cicd_ssh_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@sc-swarm-mgr.fhcrc.org docker stack deploy --with-registry-auth -c - itn-dashboard