Docker volume issue
Hi, trying to run my bot inside of a docker container on my server (exposing the workdir to the host for changes).
Yes, these files are stolen from the official repos.
Current bind shows no files on the host and the attached error when trying to run the container. If I run the container without any mount points then it runs fine.
Solution:Jump to solution
No but you can make the GH action that also published the new image to run that command on the server
13 Replies
Please change that network name lmfao. That's an inside joke for me and me alone.
and why do you want to use a volume map like that? You're supposed to build a new docker image (in GH CI) then pull and restart on the server. You're not supposed to have the source files on the server as well, at that point you may as well just use pm2 instead of docker.
1. push code
2. trigger GH action
3. this publishes a new version of the docker image to the github container registry
4. run
docker compose pull lyra && docker compule up -d --force-recreate --no-deps lyra
to pull and restart the bot on the server
5. ???
6. profit!I don't want to have to check every 5 minutes (or whatever) for updates using a separate docker container on my server there a way to listen to updates?
there probably is
I'll look in to it
Solution
No but you can make the GH action that also published the new image to run that command on the server
I created https://github.com/favware/ssh-remote-action for that purpose. Currently only use it for https://github.com/favware/graphql-pokemon but in the future more.
GitHub
GitHub - favware/ssh-remote-action: A GitHub action for executing a...
A GitHub action for executing a SSH command on a remote server - GitHub - favware/ssh-remote-action: A GitHub action for executing a SSH command on a remote server
also you dont need to check every 5 minutes. You check when you push new code. There is no reason to check otherwise.
when you've pushed new code and you want it to be released to the masses you update and restart the bot. Either don't automated it at all, or automate on every commit as mentioned above
this is why I am in a server with smart people
just 1 thing to keep in mind with ssh-remote-action, it wont have access to aliases and env vars and the like on the server that you load through
.bashrc
/ .zshrc
etc. So for the command you configure keep that in mind.
also best to use absolute paths if you need to cd
anything so no ~/
stuff
for graphql-pokemon I have a script called control.sh
at /root/workspace/control.sh
so I call /root/workspace/control.sh update pokedex-v8
(update = in the switchcase of the script, pokedex-v8
is the service in docker-compose)
but if you have just the 1 service just embed it as the commadn, no need to call a shell scriptthank you!!
@Favna am i correct in assuming the example workflow yml is the only one needed for building image/deploying it?
just confirming that "publish" means build/push docker image
confused as to why it is "on release" when the workflow is the one triggering a release?
https://github.com/favware/graphql-pokemon/actions/runs/7334424446/workflow is this the relevant workflow for what I am trying to do?
and how the F*** do I push to GHCR?!?
@HealthCareUSA this is broken down to the essential
thank you!!
what keytype does this support?
Any your server does. It just uses
ssh
in the background.interesting
for some reason it isn't letting me use it, yet I use the same key for SFTP
figured it out
unsupported format lol
converted to openssh format