I’ve been trying to figure this part out for a few days. I have my own Forgejo instance and a website each running in separate containers on a Raspberry Pi. I also have the forgejo runner installed in another docker container. I followed some guides to set up forgejo actions, but all the guides end with a simple example that basically just runs the “ls” command.

I tried running ‘docker compose up’ inside my workflow, but it fails with “docker: command not found”. So how do you use the workflow to actually update the website in the other container?

I think I’d prefer keeping everything in docker but I’d be okay with making the workflow run some script on the host machine if needed.

  • tofu
    link
    fedilink
    English
    arrow-up
    2
    ·
    30 minutes ago

    The error comes from the fact that you run the forgejo runner with an image that doesn’t have Docker, you’d need docker-in-docker (dind) in that case. But to update the homepage, you need to run docker on the host where it is.

    There’s 2 common ways to achieve what you want.

    1. on the website host, run an agent that checks out the git repo in intervals (or gets triggered by a forgejo webhook) and deploys it there. A common solution for that is Komodo, but there’s others as well. You don’t need the forgejo runner in this scenario, at least not for the deployment, everything is managed by Komodo.

    2. in the forgejo runner, you run a script that sshs into the website host and runs docker there, checking out the remote repo and deploys it with docker. A common tool for this is Ansible, which has modules for a lot of cases so you don’t need to cobble together an ugly bash script