Set docker context explicitly
This commit is contained in:
parent
f8724cc704
commit
1f6479d879
12
.github/workflows/deploy_api.yml
vendored
12
.github/workflows/deploy_api.yml
vendored
|
|
@ -2,7 +2,7 @@ name: Deploy API
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ['main']
|
branches: ['chore/setup-workflow']
|
||||||
paths: ['api/**']
|
paths: ['api/**']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
@ -13,10 +13,6 @@ jobs:
|
||||||
name: Build Docker image and push to GitHub Container Registry
|
name: Build Docker image and push to GitHub Container Registry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: api
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
@ -34,7 +30,7 @@ jobs:
|
||||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/api
|
images: ${{ env.REGISTRY }}/${{ github.repository }}/api
|
||||||
- uses: docker/build-push-action@v4
|
- uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: ./api
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
@ -52,7 +48,7 @@ jobs:
|
||||||
key: ${{ secrets.EC2_SSH_KEY }}
|
key: ${{ secrets.EC2_SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
|
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 stop crabfit-api
|
||||||
docker rm 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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue