From 1b5a0c80a2c136f562696158c1a8025b98bbe4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B0=80=EC=98=81?= Date: Sat, 27 Jul 2024 01:44:09 +0900 Subject: [PATCH] ci: modify pipeline --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52ad4f4..be66d33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,24 +40,24 @@ jobs: host: ${{ secrets.HOST_PROD }} # EC2 퍼블릭 IPv4 DNS username: ubuntu key: ${{ secrets.PRIVATE_KEY }} # EC2 private key - port: ${{ secrets.PORT }} #ssh port (22) + port: ${{ secrets.PORT }} # ssh port (22) envs: GITHUB_SHA script: | + # 기존 컨테이너와 이미지를 정리 docker stop sopo_v2 || true docker rm sopo_v2 || true docker rmi ${{ secrets.DOCKER_USERNAME }}/sopo_v2 || true - docker pull ${{ secrets.DOCKER_USERNAME }}/sopo_v2 - docker run -d -p 8080:8080 --name sopo_v2 ${{ secrets.DOCKER_USERNAME }}/sopo_v2 + # Docker Compose 파일이 있는 디렉토리로 이동 mkdir -p /home/ubuntu/app cd /home/ubuntu/app - - # 기존 docker-compose.yml 파일을 덮어쓰거나 생성 + + # docker-compose.yml 파일을 생성하거나 덮어쓰기 echo "${{ secrets.DOCKER_COMPOSE }}" > docker-compose.yml - + # Docker Compose 명령어 실행 docker-compose pull docker-compose up -d - + # 사용하지 않는 Docker 데이터 정리 (선택 사항) docker system prune -f \ No newline at end of file