release v0.1 #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Production | |
on: | |
push: | |
branches: "production" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/production_disappear:latest | |
- name: Connect via SSH and restart container | |
uses: appleboy/ssh-action@v0.1.9 | |
with: | |
host: ${{ secrets.PD_HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PD_KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
sudo docker stop production_container || true | |
sudo docker rm production_container || true | |
sudo docker run --name production_container -p 80:8000 -d \ | |
-e DBHOST=${{ secrets.PD_DBHOST }} \ | |
-e DBPORT=${{ secrets.PD_DBPORT }} \ | |
-e DBUSER=${{ secrets.DBUSER }} \ | |
-e DBNAME=${{ secrets.DBNAME }} \ | |
-e DBPASS=${{ secrets.PD_DBPASS }} \ | |
-e SECRET=${{secrets.SECRET}} -e SERVER=${{secrets.SERVER}} -e SMTP_PASS=${{secrets.SMTP_PASS}} -e SMTP_USER=${{secrets.SMTP_USER}} -e SMTP_PORT=${{secrets.SMTP_PORT}} -e CCNAME=${{secrets.CCNAME}} -e CCAPIKEY=${{secrets.CCAPIKEY}} -e CCAPISECRET=${{secrets.CCAPISECRET}} -e CCFOLDER=${{secrets.CCFOLDER}} -e OPENAIAPIKEY=${{secrets.OPENAIAPIKEY}} -e MONGOURL=${{secrets.MONGOURL}} -e CLIENTKEY=${{secrets.CLIENTKEY}} -e SERVERKEY=${{secrets.SERVERKEY}} -e REDIS_ADDR=${{secrets.REDIS_ADDR}} -e REDIS_PASS=${{secrets.REDIS_PASS}} -e RESIKEY=${{secrets.RESIKEY}} -e FIREBASEKEY=${{secrets.FIREBASEKEY}} ${{ secrets.DOCKERHUB_USERNAME }}/production_disappear:latest |