Skip to content

Commit

Permalink
Merge pull request #115 from Ong-gi-Jong-gi/dongyeoppp-patch-1
Browse files Browse the repository at this point in the history
Dongyeoppp patch 1
  • Loading branch information
dongyeoppp authored Jul 23, 2024
2 parents 826f58a + 441091b commit ffc4d3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/Spring Boot CI-CD.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Workflow 이름
name: dongyeop CI/CD with Docker and EC2
name: Spring Boot CI/CD with Docker and EC2

# 어떤 이벤트가 발생하면 workflow 실행할 지 명시
on:
# main 브랜치와 dev 브랜치에 push나 pull request 발생 시
push:
branches: [ "feature/TSK-56/alarm" ]
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

# 위 이벤트 발생 시 실행될 작업들
jobs:
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:

# 이미지 이름을 날짜와 함께 설정
- name: Set image name with date
run: echo "IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/dongyeoppi:$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
run: echo "IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV

# Docker 이미지 빌드 및 푸시
- name: Build and push Docker image
Expand Down Expand Up @@ -91,9 +93,9 @@ jobs:
id: read-image-name
run: echo "IMAGE_NAME=$(cat image-name.txt)" >> $GITHUB_ENV

# # 프로젝트 이름을 환경 변수로 설정
# - name: Set project name
# run: echo "PROJECT_NAME=dongyeoppi" >> $GITHUB_ENV
# 프로젝트 이름을 환경 변수로 설정
- name: Set project name
run: echo "PROJECT_NAME=${{ secrets.PROJECT_NAME }}" >> $GITHUB_ENV

# EC2에 SSH로 접속하여 배포
- name: SSH into EC2 and deploy
Expand All @@ -111,7 +113,7 @@ jobs:
sudo docker stop $EXISTING_CONTAINER
sudo docker rm $EXISTING_CONTAINER
fi
sudo docker run -d --name dongyeoppi -p 8081:8080 \
sudo docker run -d --name ${{ env.PROJECT_NAME }} -p 8080:8080 \
-e SPRING_DATASOURCE_URL="${{ secrets.DB_URL }}" \
-e SPRING_DATASOURCE_USERNAME="${{ secrets.DB_USERNAME }}" \
-e SPRING_DATASOURCE_PASSWORD="${{ secrets.DB_PASSWORD }}" \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/dongyeop CI-CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ jobs:
-e OPENAI_API_KEY="${{ secrets.OPENAI_API_KEY }}" \
-e FFMPEG_PATH="${{ secrets.FFMPEG_PATH }}" \
-e FFPROBE_PATH="${{ secrets.FFPROBE_PATH }}" \
# -e FIREBASE_CONFIG_PATH="/app/resources/mooluck-fcm-firebase-adminsdk-cjwp5-cd30150b1a.json" \
${{ env.IMAGE_NAME }}
sudo docker ps -a
sudo docker system prune -f
Expand Down

0 comments on commit ffc4d3a

Please sign in to comment.