sim_free/.github/workflows/docker-image.yml

43 lines
1.1 KiB
YAML

name: Docker Image build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
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@v2
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 }}
password: ${{ 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