Skip to content

Commit

Permalink
[Feat]: ci-cd 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 31, 2024
1 parent 7d7602a commit 7a0a530
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@ jobs:
needs: ci # ci job이 성공적으로 끝나야 cd job이 실행됩니다.

# appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다.
# script의 내용은 도커의 기존 프로세스들을 제거하고, docker repo로부터 방금 위에서 push한 내용을 pull 받아 실행하는 것입니다.
# script의 내용은 도커의 기존 프로세스들을 제거하고, docker repo로부터 방금 위에서 push한 내용을 pull 받아 실행하는 것입니다.
# 실행 시, docker-compose를 사용합니다.
steps:
# - name: ✔️ send docker-compose.yml to EC2 server
# uses: appleboy/[email protected]
# with:
# username: ec2-user
# host: ${{ secrets.HOST }}
# key: ${{ secrets.KEY }}
# port: 22
# source: "dev/docker-compose.dev.yml"
# target: "/home/ec2-user"

- name: Deploy to server
uses: appleboy/ssh-action@master
id: deploy
Expand All @@ -54,3 +64,5 @@ jobs:
docker image prune -f # 사용하지 않는 도커 이미지들을 제거합니다.
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
docker run -d -p 80:8080 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
#docker-compose -f /home/ec2-user/docker-compose.dev.yml up -d
30 changes: 30 additions & 0 deletions dev/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
# 실행명령어
# docker-compose -f ./docker-compose.dev.yml up
services:
zzansuni-mysql:
image: mysql
restart: always
volumes:
- ./mysql-data:/var/lib/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: zzansuni
MYSQL_ROOT_PASSWORD: root
zzanuni-spring:
image: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
restart: always
ports:
- "80:8080"
depends_on:
- zzansuni-mysql
environment:
SPRING_PROFILES_ACTIVE: dev
JWT_SECRET: 4099a46b-39db-4860-a61b-2ae76ea24c43
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }}
KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}

14 changes: 0 additions & 14 deletions docker-compose.dev.yml

This file was deleted.

0 comments on commit 7a0a530

Please sign in to comment.