Not much experience with Forgejo, but for the docker compose part, you can just ssh to the host machine. Guess you're just depending on :latest for your app, otherwise it won't work (unless you generate your compose file). The whole script can reside in the pipeline, or in a separate repo on the host, whatever is easier.
Use key auth for ssh and run the whole thing under a non root user that's part of the docker group. Beware the permissions inside the Web app container too.