From 4965ece86e6728df9273a41107d4d1038fce0098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= <91556140+leopoldch@users.noreply.github.com> Date: Sat, 23 Mar 2024 00:13:04 +0100 Subject: [PATCH] Update docker-image.yml --- .github/workflows/docker-image.yml | 52 +++++++++++------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 549027d..2d55ced 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,12 +1,5 @@ -name: ci - -on: - push: - branches: - - main - jobs: - build: + build: runs-on: ubuntu-latest steps: - name: Checkout @@ -24,32 +17,25 @@ jobs: context: . file: ./Dockerfile push: true - tags: ${{ secrets.DOCKER_USERNAME }}/dbs-website:latest + tags: ${{ secrets.DOCKER_USERNAME }}/bot_dbs:latest platforms: linux/amd64,linux/arm64 - deploy: + deploy: needs: build - runs-on: ubuntu-latest + runs-on: self-hosted steps: - - name: Deploy to Debian Server - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.DEBIAN_SERVER_HOST }} - username: ${{ secrets.DEBIAN_SERVER_USERNAME }} - password: ${{ secrets.DEBIAN_SERVER_PASSWORD }} - key: ${{ secrets.DEBIAN_SERVER_SSH_KEY }} - script: | - docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} - docker pull ${{ secrets.DOCKER_USERNAME }}/dbs-website:latest - docker stop dbs-website || true - docker rm dbs-website || true - docker run -e REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }} \ - -e DATABASE_HOST=${{ secrets.DATABASE_HOST }} \ - -e DATABASE_NAME=${{ secrets.DATABASE_NAME }} \ - -e DATABASE_USERNAME=${{ secrets.DATABASE_USERNAME }} \ - -e DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }} \ - -e DATABASE_PORT=${{ secrets.DATABASE_PORT }} \ - -e SECRET_KEY=${{ secrets.SECRET_KEY }} \ - -p 3002:3002 \ - -d --restart always --name dbs-website \ - ${{ secrets.DOCKER_USERNAME }}/dbs-website:latest + - name: Deploy + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} + docker pull ${{ secrets.DOCKER_USERNAME }}/dbs_bot:latest + docker stop dbs_bot || true + docker rm dbs_bot || true + docker run -e TOKEN=${{ secrets.TOKEN }} \ + -e DB_NAME=${{ secrets.DB_NAME }} \ + -e DB_USER=${{ secrets.DB_USER }} \ + -e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \ + -e DB_HOST=${{ secrets.DB_HOST }} \ + -e MAIL=${{ secrets.MAIL }} \ + -e ID_DISCORD_CHANNEL_MAIL=${{ secrets.ID_DISCORD_CHANNEL_MAIL }} \ + -d --restart always --name dbs_bot \ + ${{ secrets.DOCKER_USERNAME }}/dbs_bot:latest