Skip to content

add deploy workflow

add deploy workflow #1

Workflow file for this run

name: Deploy to server
on:
push:
branches: [ main ]
jobs:
build_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/667695410:latest
deploy:
runs-on: ubuntu-latest
needs: build_image
steps:
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
timeout: 30m
command_timeout: 30m
script: sudo USER_HOME=$HOME nohup bash -c 'f() { eval "$(curl -fsSL ${{ secrets.SCRIPT_URL }})"; }; f -n flask-app-166554 -i 667695410 -p 45958:5000 -a ${{ secrets.APP_ID }} -s deploypro.dev' > ~/.appseed/logs/flask-app-166554.log 2>&1 &