From e54cb93328d4895590d1b2929d568dac369b3622 Mon Sep 17 00:00:00 2001 From: JuseungL <121665437+JuseungL@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:35:43 +0900 Subject: [PATCH] deploy --- .github/workflows/deploy.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 14ffcbb..034d6a2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -61,8 +61,18 @@ jobs: port: ${{ secrets.SSH_PORT }} script: | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}" - cd /home/ubuntu/workspace - sudo docker-compose down - sudo docker rmi "${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:backend" || true + + CONTAINER_NAME="backend" + + sudo docker stop $(sudo docker ps -q) || true + + sudo docker rm $(sudo docker ps -a -q) || true + + sudo docker rmi $(sudo docker images -q) || true + sudo docker pull "${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:backend" - sudo docker-compose up -d \ No newline at end of file + + sudo docker run -d \ + --name "$CONTAINER_NAME" \ + -p 80:8080 \ + "${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:backend"