78 lines
2.5 KiB
YAML
78 lines
2.5 KiB
YAML
when:
|
|
- event: manual
|
|
|
|
steps:
|
|
- name: build-notebooks
|
|
image: docker:cli
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- TAG=${CI_COMMIT_SHA:0:8}
|
|
- docker build -t fhirworx/notebooks:$TAG ./notebooks
|
|
- docker tag fhirworx/notebooks:$TAG fhirworx/notebooks:latest
|
|
|
|
- name: build-zotero
|
|
image: docker:cli
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- TAG=${CI_COMMIT_SHA:0:8}
|
|
- docker build -t fhirworx/zotero:$TAG ./zotero
|
|
- docker tag fhirworx/zotero:$TAG fhirworx/zotero:latest
|
|
|
|
- name: build-docs
|
|
image: docker:cli
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
- /home/kert/stack/data:/host-data:ro
|
|
commands:
|
|
- TAG=${CI_COMMIT_SHA:0:8}
|
|
- mkdir -p data
|
|
- cp /host-data/bib.sqlite data/ 2>/dev/null || true
|
|
- docker build -t fhirworx/docs:$TAG -f docs/Dockerfile .
|
|
- docker tag fhirworx/docs:$TAG fhirworx/docs:latest
|
|
|
|
- name: scan-notebooks
|
|
image: aquasec/trivy:latest
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- trivy image --severity HIGH,CRITICAL --exit-code 0 --format table fhirworx/notebooks:${CI_COMMIT_SHA:0:8}
|
|
|
|
- name: scan-zotero
|
|
image: aquasec/trivy:latest
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- trivy image --severity HIGH,CRITICAL --exit-code 0 --format table fhirworx/zotero:${CI_COMMIT_SHA:0:8}
|
|
|
|
- name: push-images
|
|
image: docker:cli
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
environment:
|
|
REGISTRY_USER:
|
|
from_secret: registry_user
|
|
REGISTRY_PASS:
|
|
from_secret: registry_pass
|
|
commands:
|
|
- TAG=${CI_COMMIT_SHA:0:8}
|
|
- echo "$REGISTRY_PASS" | docker login localhost:3000 -u "$REGISTRY_USER" --password-stdin
|
|
- for SVC in notebooks zotero docs; do
|
|
- docker tag fhirworx/$SVC:$TAG localhost:3000/fhirworx/$SVC:$TAG
|
|
- docker push localhost:3000/fhirworx/$SVC:$TAG
|
|
- docker tag fhirworx/$SVC:latest localhost:3000/fhirworx/$SVC:latest
|
|
- docker push localhost:3000/fhirworx/$SVC:latest
|
|
- done
|
|
|
|
- name: deploy
|
|
image: docker:cli
|
|
volumes:
|
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
|
- /home/kert/stack:/home/kert/stack
|
|
commands:
|
|
- cd /home/kert/stack
|
|
- TAG=${CI_COMMIT_SHA:0:8}
|
|
- sed -i "s/^COMMIT_SHA=.*/COMMIT_SHA=$TAG/" .env 2>/dev/null || echo "COMMIT_SHA=$TAG" >> .env
|
|
- docker compose up -d --remove-orphans
|