build & deploy Docker image #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build & deploy Docker image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- deploy | |
env: | |
DOCKER_IMAGE: registry.gitlab.tpwd.de/tpwd/bb-navi/amarillo | |
DOCKER_TAG: production | |
jobs: | |
docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
with: | |
registry: git.bbnavi.de | |
username: ${{ secrets.REGISTRY_USER }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: git.bbnavi.de/bbnavi-reg/ocpdb-proxy:latest | |
deploy: | |
runs-on: self-hosted | |
needs: | |
- docker-image | |
environment: production | |
env: | |
ADMIN_TOKEN: ${{ secrets.ADMIN_TOKEN }} | |
RIDE2GO_TOKEN: ${{ secrets.RIDE2GO_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: generate Docker stack markup | |
run: | | |
set -o pipefail | |
docker-compose -f quantum-stack.yml config | tee stack.yml | |
echo -e "---\nversion: '1.0'\ncompose: stack.yml" >.quantum | |
- name: Deploy to swarm | |
uses: sagebind/docker-swarm-deploy-action@v2 | |
with: | |
remote_host: ssh://ec2-user@3.79.201.75 | |
ssh_private_key: ${{ secrets.AWS_SSH_PRIVATE_KEY }} | |
ssh_public_key: ${{ secrets.AWS_SSH_MANAGER_PUBKEY }} | |
args: stack deploy --compose-file .quantum bbnavi-amarillo | |
# - name: Deploy to Planetary Quantum | |
# run: | | |
# set -x | |
# docker run --rm -i \ | |
# -v $PWD:/app -w /app \ | |
# -e QUANTUM_USER -e QUANTUM_PASSWORD -e QUANTUM_ENDPOINT -e QUANTUM_STACK \ | |
# r.planetary-quantum.com/quantum-public/cli:2 \ | |
# quantum-cli stacks update --create --wait |