Skip to content

Commit

Permalink
push docker image to GCP registery
Browse files Browse the repository at this point in the history
  • Loading branch information
JangAyeon committed Apr 14, 2024
1 parent 9f6e406 commit 63f747d
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
name: Deploy Discord-Study
name: Create and publish a Docker image to GCP Artifact Registry

on:
push:
branches:
- "main"
- main

env:
REGISTRY: ${{ secrets.GAR_REGISTRY }}
IMAGE_NAME: image

jobs:
deploy:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: code checkout
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v3

- name: install gcloud CLI
uses: google-github-actions/setup-gcloud@v1
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
project_id: ${{secrets.GOOGLE_PROJECT}}
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
export_default_credentials: true

# Configure docker to use the g cloud command-line tool as a credential helper
- name: gcloud auth configure-docker
env:
GOOGLE_PROJECT: ${{secrets.GOOGLE_PROJECT}}
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev
docker build -t us-central1-docker.pkg.dev/discord-study-bot-420101/discord-study-docker/image:latest .
## docker push us-central1-docker.pkg.dev/discord-study-bot-420101/discord-study-docker/discord-study-docker:latest
registry: ${{ env.REGISTRY }}
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}

0 comments on commit 63f747d

Please sign in to comment.