Skip to content

Add docker-compose and harden Dockerfile#48

Open
jouls0217 wants to merge 3 commits into
averygan:mainfrom
jouls0217:docker-improvements
Open

Add docker-compose and harden Dockerfile#48
jouls0217 wants to merge 3 commits into
averygan:mainfrom
jouls0217:docker-improvements

Conversation

@jouls0217
Copy link
Copy Markdown

@jouls0217 jouls0217 commented May 12, 2026

  • Add docker-compose.yml with 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.
  • 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 and PYTHONDONTWRITEBYTECODE so logs stream to docker logs in real time and no .pyc files are written.
    • Switch the entrypoint from Flask's dev server to gunicorn for production use, configured with one worker and multiple threads so the in-memory jobs dict and download threads are shared across requests (multiple workers would each see their own state, breaking status polling and file retrieval).
    • Enable gunicorn access logging to stdout so HTTP requests show up in docker logs.

jouls0217 added 3 commits May 12, 2026 16:11
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant