Skip to content

Commit

Permalink
fix:Docker Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeg00 committed Apr 26, 2024
1 parent 266362a commit c50451c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs: #작업을 정의
with:
gradle-version: 7.2 #그래들 버전 7.2 사용
arguments: clean build -x test
# 2. Docker Registry 실행
- name: docker registry run
run: docker run --name private-repo -d -p 5000:5000 registry

# 3. Docker 이미지 빌드
- name: docker image build
Expand All @@ -63,11 +66,11 @@ jobs: #작업을 정의
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name : docker tag
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/just localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:1.0
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/just localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just

# 5. Docker Hub 이미지 푸시
- name: docker Hub push
run: docker push localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:1.0
run: docker push localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just

run-docker-image-on-ec2:
# build-docker-image (위)과정이 완료되어야 실행됩니다.
Expand All @@ -77,15 +80,15 @@ jobs: #작업을 정의
steps:
# 1. 최신 이미지를 풀받습니다
- name: docker pull
run: sudo docker pull localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:1.0
run: sudo docker pull localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just

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

# 3. 최신 이미지를 컨테이너화하여 실행시킵니다
- name: docker run new container
run: sudo docker run --name just --rm -d -p 9000:9000 localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:1.0
run: sudo docker run --name just --rm -d -p 9000:9000 localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just

# 4. 미사용 이미지를 정리합니다
- name: delete old docker image
Expand Down

0 comments on commit c50451c

Please sign in to comment.