Add docker-compose and harden Dockerfile#48
Open
jouls0217 wants to merge 3 commits into
Open
Conversation
- Add docker-compose.yml with explicit image/container names, port mapping, downloads volume mount, and restart policy for a one-command local deployment. - Add .dockerignore to keep .git, downloads, caches, and editor files out of the build context, shrinking the image and improving cache reuse on rebuilds. - Harden the Dockerfile: run as a non-root user, set PYTHONUNBUFFERED so logs stream to docker logs in real time, install curl for the new HEALTHCHECK against the index route, and switch the entrypoint from Flask's dev server to gunicorn for production use.
Switch downloads to a named volume to avoid host permission issues on first run, and adjust gunicorn to one worker with multiple threads so the in-memory jobs dict is shared across requests. Also enable access logging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker-compose.ymlwith explicit image/container names, port mapping, a named volume for downloads, and a restart policy for one-command local deployment. A named volume is used instead of a bind mount so the container works out-of-the-box on a fresh clone without host-side permission setup..dockerignoreto keep.git,downloads, caches, and editor files out of the build context, shrinking the image and improving cache reuse on rebuilds.Dockerfile:PYTHONUNBUFFEREDandPYTHONDONTWRITEBYTECODEso logs stream todocker logsin real time and no.pycfiles are written.jobsdict and download threads are shared across requests (multiple workers would each see their own state, breaking status polling and file retrieval).docker logs.