Skip to content

Commit

Permalink
GH workflow to build Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ianpatton committed May 2, 2024
1 parent 3db86d6 commit f30832d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Docker Image

on:
push:
branches: ["main"]
env:
PROJECT_ID: formfree-400917
REGION: us-central1
GAR_LOCATION: us-central1-docker.pkg.dev/formfree-400917/images/dwn-server
jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- id: "auth"
name: "Authenticate with Google Cloud"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}"
token_format: "access_token"

- uses: "docker/login-action@v1"
name: "Docker login"
with:
registry: "us-central1-docker.pkg.dev"
username: "oauth2accesstoken"
password: "${{ steps.auth.outputs.access_token }}"

- name: Build image
run: docker build . --tag ${{ env.GAR_LOCATION }}:${{github.sha}}

- name: Push image
run: docker push ${{ env.GAR_LOCATION }}:${{github.sha}}

0 comments on commit f30832d

Please sign in to comment.