pinning requirments to tested versions #10
Workflow file for this run
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: Prod Satyrn API | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: [main] | |
# allows you to manually execute this pipeline from the Actions tab. | |
workflow_dispatch: | |
jobs: | |
build_push_pull_docker_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v2 | |
- name: Build image | |
run: docker build -t registry.digitalocean.com/scales-okn/satyrn-api:latest . | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITAL_OCEAN_ACCESS_TOKEN }} | |
- name: Log in to DO Container Registry | |
run: doctl registry login --expiry-seconds 600 | |
- name: Push image to DO Container Registry | |
run: docker push registry.digitalocean.com/scales-okn/satyrn-api:latest | |
- name: Clean up DO Container Registry | |
run: doctl registry garbage-collection start --include-untagged-manifests --force | |
- name: Create the .ssh directory | |
run: mkdir ~/.ssh && chmod 700 ~/.ssh | |
- name: Install private key for droplet | |
run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa | |
- name: Add droplet host to known hosts | |
run: echo "${{ secrets.SSH_KNOWN_PROD_HOSTS }}" > ~/.ssh/known_hosts | |
- name: Log in to Droplet and pull updated image | |
run: ssh root@${{ secrets.PROD_HOST }} "/bin/bash -c 'cd scales-satyrn && docker compose pull api && docker compose stop api && docker-compose up -d --no-deps api && docker image prune -f'" |