fix: add conditional root path #24
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: Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: Deploy | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: "Authenticate Google Cloud" | |
uses: "google-github-actions/auth@v1" | |
with: | |
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v1" | |
- name: "Docker auth" | |
run: |- | |
gcloud auth configure-docker ${{ vars.REGION }}-docker.pkg.dev --quiet | |
- name: Build Docker Image | |
run: | | |
mkdir ./keys | |
echo '${{ secrets.CREDENTIALS }}' > ./keys/credentials.json | |
ls | |
ls ./keys | |
docker build --tag ${{ vars.GAR_LOCATION }}/backend . | |
- name: Push image | |
run: docker push ${{ vars.GAR_LOCATION }}/backend | |
- name: Run Docker Image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOYMENT_HOST }} | |
username: ${{ secrets.DEPLOYMENT_HOST_USERNAME }} | |
key: ${{ secrets.DEPLOYMENT_HOST_KEY }} | |
port: 22 | |
script: | | |
gcloud auth configure-docker ${{ vars.REGION }}-docker.pkg.dev --quiet | |
docker container rm -f chefies-backend | |
docker image rm -f ${{ vars.GAR_LOCATION }}/backend | |
docker run --name chefies-backend -e PRODUCTION=1 -e GOOGLE_APPLICATION_CREDENTIALS="/app/keys/credentials.json" -d --restart always -p 9000:80 ${{ vars.GAR_LOCATION }}/backend |