Skip to content

Commit

Permalink
feature: dockerイメージのbuildとpushワークフロー追加
Browse files Browse the repository at this point in the history
  • Loading branch information
takumi-pro committed Dec 30, 2023
1 parent ede05e3 commit 3698724
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/deploy-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ permissions:
id-token: write
contents: read

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -25,7 +28,7 @@ jobs:
- name: test
run: go test ./... -v

gcp-test:
build-push-artifact:
runs-on: ubuntu-latest
needs: test
steps:
Expand All @@ -35,5 +38,8 @@ jobs:
workload_identity_provider: "projects/${{ secrets.GCP_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/github-actions-oidc/providers/github-actions-oidc-provider"
service_account: ${{ secrets.GCP_SA_EMAIL }}

- name: Test
run: gcloud iam service-accounts list
- name: Build image
run: docker image build -t asia-northeast1-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/devlocator-app/devlocator:latest --target production --platform linux/amd64 -f docker/golang/Dockerfile .

- name: Push image
run: docker image push asia-northeast1-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/devlocator-app/devlocator:latest
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# GCP setting
IMAGE=asia-northeast1-docker.pkg.dev/sigma-method-409207/devlocator-app/devlocator

image-build:
docker image build -t $(IMAGE):latest --target production --platform linux/amd64 -f docker/golang/Dockerfile .

add-tag:
docker image tag devlocator $(IMAGE):latest

Expand Down

0 comments on commit 3698724

Please sign in to comment.