Merge pull request #86 from 9oormthonUniv-seoultech/develop #51
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: Build, Push, and Deploy Docker Image | |
on: | |
push: | |
branches: | |
- main # main 브랜치에 푸시될 때 트리거 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. 코드 체크아웃 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# 2. node_modules 캐시 설정 (필요할 경우) | |
- name: Cache node_modules | |
uses: actions/[email protected] | |
with: | |
path: ~/.npm # If using npm | |
# For yarn, use path: ~/.cache/yarn | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-modules- | |
# 3. Docker Hub에 로그인 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# 4. Docker 이미지 빌드 및 푸시 | |
- name: Build Docker image | |
run: | | |
docker build \ | |
--build-arg VITE_KAKAO_MAP_KEY=${{ secrets.VITE_KAKAO_MAP_KEY }} \ | |
--build-arg VITE_KAKAO_REST_API_KEY=${{ secrets.VITE_KAKAO_REST_API_KEY }} \ | |
-t ${{ secrets.DOCKER_USERNAME }}/pocket4cut:v1 . | |
- name: Push Docker image | |
run: | | |
docker push "${{ secrets.DOCKER_USERNAME }}/pocket4cut:v1" |