46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: Docker Image build
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
pull_request:
|
|
branches: ["main"]
|
|
schedule:
|
|
# * is a special character in YAML so you have to quote this string
|
|
- cron: "5 4 * * *"
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Docker image and push to repositories
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: login to hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: alexohneander/sim-free:latest
|
|
|
|
- name: deploying
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.SSH_HOST }}
|
|
username: ${{ secrets.SSH_USER }}
|
|
key: ${{ secrets.SSH_KEY }}
|
|
port: ${{ secrets.SSH_PORT }}
|
|
script: |
|
|
docker image pull alexohneander/sim-free:latest
|
|
docker container stop sim-free
|
|
docker container rm sim-free
|
|
docker container run -d --name sim-free -p 8000:8000 alexohneander/sim-free:latest
|