Skip to content

fixbug

fixbug #72

Workflow file for this run

name: ci
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dbs-website:latest
platforms: linux/amd64,linux/arm64
deploy:
needs: build
runs-on: ubuntu-latest
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