logging fix and connection pooling #22
This file contains hidden or 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: Docker Build & Push and Deploy to dev for score-backend | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
sha_short: ${{ steps.vars.outputs.sha_short }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get SHA | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Docker Build & Push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: cornellappdev/score-dev:${{ steps.vars.outputs.sha_short }} | |
cache-from: type=registry,ref=cornellappdev/score-dev:cache | |
cache-to: type=registry,ref=cornellappdev/score-dev:cache,mode=max | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Remote SSH and Deploy | |
uses: appleboy/[email protected] | |
env: | |
IMAGE_TAG: ${{ needs.build.outputs.sha_short }} | |
with: | |
host: ${{ secrets.DEV_SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.DEV_SERVER_KEY }} | |
envs: IMAGE_TAG | |
script: | | |
docker stack deploy -c docker-compose.yml thestack | |
docker service update --image cornellappdev/score-dev:${IMAGE_TAG} thestack_app | |
docker system prune -af |