Skip to content

Commit

Permalink
chore: push docker image to dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jul 24, 2024
1 parent d4a1225 commit b99d278
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 7 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build-dockerhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 이미지 빌드 & 푸쉬
on:
workflow_call:
outputs:
image-url:
value: ${{ jobs.build.outputs.image-url }}
inputs:
image-name:
required: true
type: string
image-tag:
required: true
type: string
spring-profile:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
build:
runs-on: [ ubuntu-latest ]
name: 이미지 빌드하기

outputs:
image-url: ${{ steps.build-image.outputs.image-url }}

permissions:
id-token: write
contents: read

steps:
- name: GitHub 에서 레포 받아오기
uses: actions/checkout@v3

- name: JDK17 준비하기
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Docker Hub 로그인하기
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Gradle 준비하기
uses: gradle/actions/setup-gradle@v3

- name: 이미지 빌드하고 푸쉬하기
id: build-image
run: |
chmod +x jib.sh &&
chmod +x ./gradlew &&
/bin/bash jib.sh \
${{ inputs.image-name }} \
${{ inputs.image-tag }} \
${{ inputs.spring-profile }} &&
echo "image-url=${{ inputs.image-name }}:${{ inputs.image-tag }}" >> $GITHUB_OUTPUT
12 changes: 5 additions & 7 deletions .github/workflows/dev-cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,17 @@ jobs:
if: github.event_name == 'push'
needs: [ prepare-variables ]
name: 이미지 빌드
uses: ./.github/workflows/build-ecr.yaml
uses: ./.github/workflows/build-dockerhub.yaml
permissions:
id-token: write
contents: read
with:
ecr-repository-name: ${{ needs.prepare-variables.outputs.ecr-repository-name }}
image-name: no5ing/bibbi-backend-api-dev
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
spring-profile: ${{ needs.prepare-variables.outputs.spring-profile }}
secrets:
AWS_ASSUME_ROLE_ARN: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
AWS_ECR_REGISTRY_URL: ${{ secrets.AWS_ECR_REGISTRY_URL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_DEV_AUTH_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_PASSWORD }}

call-deploy-workflow:
if: github.event_name == 'push'
Expand All @@ -77,7 +75,7 @@ jobs:
argocd-repo-name: bibbi-team/bibbi-argocd-manifest
overlay-name: ${{ needs.prepare-variables.outputs.spring-profile }}
service-name: bibbi-backend-api
image-name: bibbi-backend-api-dev
image-name: no5ing/bibbi-backend-api-dev
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
environment: development
default-image-name: no5ing/bibbi-backend-api
Expand Down

0 comments on commit b99d278

Please sign in to comment.