From 1f6479d879746730dec63a05173db45995187354 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Tue, 16 May 2023 17:15:00 +1000 Subject: [PATCH] Set docker context explicitly --- .github/workflows/deploy_api.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy_api.yml b/.github/workflows/deploy_api.yml index 79c336e..70c928b 100644 --- a/.github/workflows/deploy_api.yml +++ b/.github/workflows/deploy_api.yml @@ -2,7 +2,7 @@ name: Deploy API on: push: - branches: ['main'] + branches: ['chore/setup-workflow'] paths: ['api/**'] env: @@ -13,10 +13,6 @@ jobs: name: Build Docker image and push to GitHub Container Registry runs-on: ubuntu-latest - defaults: - run: - working-directory: api - permissions: contents: read packages: write @@ -34,7 +30,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ github.repository }}/api - uses: docker/build-push-action@v4 with: - context: . + context: ./api push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -52,7 +48,7 @@ jobs: key: ${{ secrets.EC2_SSH_KEY }} script: | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - docker pull ${{ env.REGISTRY }}/${{ github.repository }}/api:latest + docker pull ${{ env.REGISTRY }}/${{ github.repository }}/api:main docker stop crabfit-api docker rm crabfit-api - docker run -d -p 3000:3000 --name crabfit-api --env-file ./.env ${{ env.REGISTRY }}/${{ github.repository }}/api:latest + docker run -d -p 3000:3000 --name crabfit-api --env-file ./.env ${{ env.REGISTRY }}/${{ github.repository }}/api:main