Skip to content

Commit

Permalink
test: test for docker pull image
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongh00 committed Oct 1, 2024
1 parent f660548 commit 6a55723
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Backend CD # actions 이름
name: Backend CD

on:
push:
Expand Down Expand Up @@ -44,25 +44,7 @@ jobs:
- name: 스프링부트 애플리케이션 빌드
run: ./gradlew bootJar

# 도커 이미지 빌드 (Spring Boot)
- name: 도커 이미지 빌드 (Spring Boot)
run: sudo docker build -t ${{ secrets.DOCKER_IMG_SPRING }} --platform linux/amd64 .

# 도커 이미지 빌드 (Flask 애플리케이션)
- name: 도커 이미지 빌드 (Flask)
run: sudo docker build -t ${{ secrets.DOCKER_IMG_FLASK }} --platform linux/amd64 ./flask-app

# 도커 이미지 push (Spring Boot)
- name: 도커 이미지 push (Spring Boot)
run: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker push ${{ secrets.DOCKER_IMG_SPRING }}
# 도커 이미지 push (Flask)
- name: 도커 이미지 push (Flask)
run: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker push ${{ secrets.DOCKER_IMG_FLASK }}
# 도커 이미지 푸시 작업 생략 (이미 빌드된 이미지를 사용)

- name: scp file
uses: appleboy/scp-action@master
Expand All @@ -85,7 +67,7 @@ jobs:
echo "${{ secrets.DOCKER_COMPOSE }}" > ./docker-compose.yml
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm -f $(sudo docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_IMG_SPRING }}
sudo docker pull ${{ secrets.DOCKER_IMG_FLASK }}
sudo docker pull ${{ secrets.DOCKER_IMG_SPRING }} # Spring Boot 이미지 풀
sudo docker pull ${{ secrets.DOCKER_IMG_FLASK }} # Flask 이미지 풀
sudo docker-compose -f docker-compose.yml up -d
sudo docker image prune -f

0 comments on commit 6a55723

Please sign in to comment.