From 518ebf14dba824467d9dd739253c56e3feb2196c Mon Sep 17 00:00:00 2001 From: ohhamma Date: Tue, 8 Oct 2024 18:48:48 +0900 Subject: [PATCH] KL-184/deploy: use compose.yaml --- .github/workflows/deploy.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 55f3f065..e170cbcf 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -31,7 +31,7 @@ jobs: - name: Build with Gradle run: ./gradlew clean build -x test - - name: Dockerhub login + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -46,6 +46,15 @@ jobs: push: true tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_NAME }}:latest + - name: Copy compose.yaml to EC2 + uses: appleboy/scp-action@master + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_KEY }} + source: "compose.yaml" + target: "~/" + - name: Deploy to EC2 uses: appleboy/ssh-action@master with: @@ -54,5 +63,5 @@ jobs: key: ${{ secrets.EC2_KEY }} script: | sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_NAME }}:latest - sudo docker-compose -p eonedu up -d + sudo docker compose -f ~/compose.yaml -p eonedu up -d sudo docker image prune -a -f \ No newline at end of file