From f7f586bacbb8b1842f997eff1dd930e29d3a3987 Mon Sep 17 00:00:00 2001 From: themerous <135851347+themerous@users.noreply.github.com> Date: Sat, 27 Jul 2024 17:31:29 +0900 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 538587c..d5fcd40 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,15 +25,24 @@ jobs: - name: Build Next.js app run: pnpm build - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + + - name: Login to Docker registry + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY_URL }} + username: ${{ secrets.NAVER_ACESSKEY }} + password: ${{ secrets.NAVER_SECRETKEY }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ secrets.REGISTRY_URL }}/react-app:latest - - name: Login then Build and push Docker image - run: | - docker login -u ${{ secrets.NAVER_ACESSKEY }} -p ${{ secrets.NAVER_SECRETKEY }} ${{ secrets.REGISTRY_URL }} - docker build -t themerous/react-app:latest . - docker push themerous/react-app:latest - name: SSH and deploy uses: appleboy/ssh-action@master @@ -43,7 +52,7 @@ jobs: password: ${{ secrets.SERVER_PASSWORD }} script: | docker login -u ${{ secrets.NAVER_ACCESSKEY }} -p ${{ secrets.NAVER_SECRETKEY }} ${{ secrets.REGISTRY_URL }} - docker pull themerous/react-app:latest + docker pull ${{ secrets.REGISTRY_URL }}/react-app:latest docker stop react-app-container || true docker rm react-app-container || true - docker run -d -p 80:3000 --name react-app-container themerous/react-app:latest + docker run -d -p 80:3000 --name react-app-container ${{ secrets.REGISTRY_URL }}/react-app:latest