Skip to content

Commit

Permalink
Update gradle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeepoter authored Aug 21, 2024
1 parent bcdf16d commit 8345f5f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

# 3. Docker 이미지 빌드
- name: docker image build
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo .
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/certis .

# 4. DockerHub 로그인
- name: docker login
Expand All @@ -49,7 +49,7 @@ jobs:

# 5. Docker Hub 이미지 푸시
- name: docker Hub push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/certis

# 위 과정에서 푸시한 이미지를 ec2에서 풀받아서 실행시키는 과정
run-docker-image-on-ec2:
Expand All @@ -58,18 +58,18 @@ jobs:
runs-on: self-hosted

steps:
# 최신 이미지를 풀받습니다
# 최신 이미지 pull
- name: docker pull
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/certis

# 기존의 컨테이너를 중지시킵니다
# 기존의 컨테이너를 중지
- name: docker stop container
run: sudo docker stop $(sudo docker ps -q) 2>/dev/null || true

# 최신 이미지를 컨테이너화하여 실행시킵니다
# 최신 이미지를 docker-compose로 실행(with mysql)
- name: docker run new container
run: sudo docker run --name github-actions-demo --rm -d -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo
run: sudo docker-compose up -d

# 미사용 이미지를 정리합니다
# 미사용 이미지를 정리
- name: delete old docker image
run: sudo docker system prune -f

0 comments on commit 8345f5f

Please sign in to comment.