-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (41 loc) · 1.46 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
45
46
variables:
CI_DEBUG_SERVICES: "true"
before_script:
- apk update
- apk --no-cache add py3-pip python3 curl
- python3 -m venv $HOME/.venv
- export PATH=$HOME/.venv/bin:$PATH
- pip3 install pyyaml
- 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/eipm-calculator:test .
- docker push sc-registry.fredhutch.org/eipm-calculator:test
test:
stage: test
services:
- name: sc-registry.fredhutch.org/eipm-calculator:test
alias: eipm-calculator
script:
- sleep 15 && curl -sI http://eipm-calculator:3838 |head -1|grep -q "200 OK"
deploy:
stage: deploy
only:
refs:
- main
script:
- docker tag sc-registry.fredhutch.org/eipm-calculator:test sc-registry.fredhutch.org/eipm-calculator:latest
- docker push sc-registry.fredhutch.org/eipm-calculator: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 [email protected] docker stack deploy --with-registry-auth -c - eipm-calculator