claabs / epicgames-freegames-node

Automatically login and find available free games the Epic Games Store. Sends you a prepopulated checkout link so you can complete the checkout after logging in. Supports multiple accounts, login sessions, and scheduled runs.
https://hub.docker.com/r/charlocharlie/epicgames-freegames
MIT License
1.33k stars 89 forks source link

Stop docker container after script execution #18

Closed Andrej730 closed 4 years ago

Andrej730 commented 4 years ago

Is there option to stop script docker container after the script was executed?

claabs commented 4 years ago

Not yet. I was planning on redoing the cron feature outside of the Node app to reduce idle memory usage. It should take it from ~100MB to ~3MB while idling. I can add a feature to not idle (stop the container) along with that.

Andrej730 commented 4 years ago

I prefer to schedule script executions outside the script - I'm using crontab for that purpose. So, the option to stop script after it was executed would work great for me. My current workaround is to schedule removing container after an hour of the script execution.

claabs commented 4 years ago

See the new RUN_ONCE variable. It should be used in conjunction with RUN_ON_STARTUP=true for this use case.

Andrej730 commented 4 years ago

I'm getting the following error after the last commit:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/usr/app/entrypoint.sh\": permission denied": unknown. ERRO[0000] error waiting for container: context canceled

It seems like the solution is to add this line to dockerfile (according to similar issues like https://github.com/arangodb/arangodb-docker/issues/54 or https://github.com/passbolt/passbolt_docker/issues/8 ) RUN ["chmod", "+x", "/usr/app/entrypoint.sh"]

claabs commented 4 years ago

I tested this 50 times locally, but I guess the git permissions caught me. Looks like https://github.com/claabs/epicgames-freegames-node/commit/3ca7fa81de1cfe0ad88d5dd85b85f391d9d02fa1 fixed it. The new image is already built.