From bbbb7d85a85abfc9ab6bf17728201002d679ffdd Mon Sep 17 00:00:00 2001 From: hye-on Date: Mon, 23 Sep 2024 14:44:33 +0900 Subject: [PATCH] =?UTF-8?q?#173=20fix:=20Deploy=20to=20dev=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd_dev.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cicd_dev.yml b/.github/workflows/cicd_dev.yml index 599a551..650b87a 100644 --- a/.github/workflows/cicd_dev.yml +++ b/.github/workflows/cicd_dev.yml @@ -58,9 +58,6 @@ jobs: - name: Build with Gradle run: ./gradlew clean build - - name: docker image build - run: docker build -t togetupdev/togetupdev . - - name: Login to Docker Hub uses: docker/login-action@v1 with: @@ -69,6 +66,7 @@ jobs: - name: Docker push run: | + docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/togetupdev . docker push ${{ secrets.DOCKER_HUB_USERNAME }}/togetupdev - name: Deploy to dev @@ -79,7 +77,8 @@ jobs: key: ${{ secrets.EC2_SSH_KEY_DEV }} port: ${{ secrets.EC2_SSH_PORT }} script: | - sudo docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPO_DEV}} + sudo docker ps -qa | grep -q . && sudo docker rm -f $(docker ps -qa) + sudo docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/togetupdev docker-compose up -d sudo docker image prune -f