From 6813be9aa59ddb85a5af60311e827f0d67cb32ab Mon Sep 17 00:00:00 2001 From: minjun Date: Fri, 4 Oct 2024 21:48:18 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20dev=20=EB=8F=84=EC=BB=A4=20=EB=B0=B0?= =?UTF-8?q?=ED=8F=AC=20=EC=B6=94=EA=B0=80=20(#118)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-dev.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/ci-dev.yml diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000..69466ad --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,44 @@ +name: Deploy - prod + +on: + push: + branches: + - feat/Docker-Deploy + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.16.0] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Set environment variables for staging + if: github.ref == 'refs/heads/dev' + run: echo "${{ secrets.STAGING_ENV }}" > .env + + - name: docker build and push + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t ${{ secrets.DOCKER_REPO }}/clubber-front . + docker push ${{ secrets.DOCKER_REPO }}/clubber-front + + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: ${{ secrets.SSH_PORT }} + script: | + sudo docker rm -f $(docker ps -qa) + sudo docker pull ${{ secrets.DOCKER_REPO }}/clubber-front + docker-compose up -d + docker image prune -f