I’m trying to use GitHub Actions to run a docker image though the last command doesn’t actually finish up if that makes sense. The Docker Image does run although, despite the &
and nohup
, the specific step is marked as running forever until the docker image is stopped or killed. Is there an alternative command (nohup docker run --env-file=Timmy-SchoolSimplified/.env timmy &
) that doesn’t “hang” and immediately moves on?
This is my current workflow:
name: SSH & Deploy Image
on:
workflow_run:
workflows: ["Timmy Docker Build"]
branches: [ main ]
types:
- completed
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Run Docker CMD
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=timmy --format="{{.ID}}"))
docker pull spaceturtle0/ss-timmy:latest
docker tag spaceturtle0/ss-timmy timmy
nohup docker run --env-file=Timmy-SchoolSimplified/.env timmy &