Skip to content

Commit

Permalink
Merge pull request #75 from capstone-five-ai/refactor/cd-flow
Browse files Browse the repository at this point in the history
feat: Docker를 기반으로 한 CD 구축
  • Loading branch information
yujamint authored Jun 28, 2024
2 parents 54f34b8 + 2987003 commit cfadaf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: deploy

on:
pull_request:
push:
branches: [dev]
types: [closed]

jobs:
deploy:

runs-on: ubuntu-latest
if: github.event.pull_request.merged

steps:
- name: 체크아웃
Expand Down Expand Up @@ -42,7 +40,7 @@ jobs:
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/qtudy-server:latest
tags: ${{ secrets.DOCKERHUB_USERNAME }}/qtudy-server:latest

- name: EC2 서버에 배포
uses: appleboy/ssh-action@master
Expand All @@ -53,6 +51,7 @@ jobs:
envs: GITHUB_SHA
script: |
sudo docker stop $(sudo docker ps -a -q)
sudo docker pull ${{secrets.DOCKER_USERNAME}}/qtudy-server
sudo docker run -d -p 8080:8080 --name qtudy-server-container ${{secrets.DOCKER_USERNAME}}/qtudy-server
sudo docker rm $(sudo docker ps -a -q)
sudo docker pull ${{secrets.DOCKERHUB_USERNAME}}/qtudy-server
sudo docker run -d -p 8080:8080 --name qtudy-server-container ${{secrets.DOCKERHUB_USERNAME}}/qtudy-server
sudo docker image prune -f
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM amazoncorretto:11-alpine-jdk
EXPOSE 8080
COPY ./build/libs/Qtudy-server-0.0.1-SNAPSHOT.jar /app.jar
CMD ["java", "-jar", "app.jar", "--spring.profiles.active=stage"]

0 comments on commit cfadaf4

Please sign in to comment.