Skip to content

Add Dockerfile and entrypoint for local container use#53

Draft
Reddshift wants to merge 2 commits into
redpointsec:mainfrom
Reddshift:feat/dockerfile-and-entrypoint
Draft

Add Dockerfile and entrypoint for local container use#53
Reddshift wants to merge 2 commits into
redpointsec:mainfrom
Reddshift:feat/dockerfile-and-entrypoint

Conversation

@Reddshift

Copy link
Copy Markdown

Summary

Adds a minimal Dockerfile, entrypoint.sh, and .dockerignore so the app can be run as a single container for training and integration-testing setups, without changing any application behavior.

  • Single-stage python:3.12-slim image
  • System packages cover the mysqlclient wheel build (still in requirements.txt even though the default SQLite config does not use MySQL)
  • Bundles redis-server because taskManager.settings hard-codes REDIS_HOST = 'localhost' and login uses it for failed-attempt tracking; running it in-container keeps the deployment a single service and avoids changing settings.py
  • entrypoint.sh runs manage.py migrate on every start and loaddata taskManager/fixtures/* only on a fresh database, so restarts preserve session state
  • OPENROUTER_API_KEY is accepted as an alias for OPENAI_API_KEY (the chatbot already defaults its base URL to OpenRouter)

Usage

docker build -t vtm .
docker run --rm -p 8000:8000 vtm
# browse http://localhost:8000/

Optionally pass an API key for the AI assistant:

docker run --rm -p 8000:8000 -e OPENAI_API_KEY=sk-... vtm

Context

Drafted while building a local integration test target for SurveyorCrawler. The same files are vendored at test/vtm-django/ in that repo so the integration test works regardless of whether this PR merges; if/when it lands, the vendored copies can be removed.

Test plan

  • docker build -t vtm . completes
  • docker run --rm -p 8000:8000 vtm starts and prints "Starting development server"
  • http://localhost:8000/taskManager/login/ returns the login page
  • Log in as chris / test123 (and seth / soccerlover) from the existing fixtures
  • Restarting the container preserves state (no fixture reload)
  • OPENROUTER_API_KEY env var is picked up by the chatbot

Note

Marked as draft for review — no code-path changes outside of containerization, but happy to adjust the system-package set, Python version, or fixture-load policy.

Reddshift added 2 commits June 2, 2026 22:00
Single-stage python:3.12-slim image with system packages needed to build
mysqlclient (still in requirements.txt although the default SQLite config does
not use it). Bundles redis-server because taskManager.settings hard-codes
REDIS_HOST=localhost and login uses it for failed-attempt tracking; keeping it
in-container preserves the single-service developer experience.

entrypoint.sh applies migrations on every start and loads the fixtures
(taskManager/fixtures/*) the first time only, then execs the runserver command
passed via CMD. OPENROUTER_API_KEY is accepted as an alias for OPENAI_API_KEY
so callers using OpenRouter naming work without extra configuration.

Default training credentials (chris/test123, seth/soccerlover, etc.) come from
the existing fixtures; no behavior changes outside of containerization.

  docker build -t vtm .
  docker run --rm -p 8000:8000 vtm
  # browse http://localhost:8000/
mysqlclient is referenced only from a commented-out DATABASES block in
taskManager/settings.py — the default configuration uses SQLite. Keeping
mysqlclient in requirements.txt forces the image to install
build-essential, default-libmysqlclient-dev, and pkg-config to build a
wheel that is never imported.

Comment out the requirement and drop those system packages, which
shaves install time and image size with no functional change.

If someone wants to switch back to MySQL, uncommenting the requirement
and re-adding the system deps is straightforward.
@Reddshift

Copy link
Copy Markdown
Author

Updated: mysqlclient is now commented out in requirements.txt, and the matching default-libmysqlclient-dev / pkg-config / build-essential system packages are dropped from the Dockerfile. The package is only referenced from a commented-out DATABASES block in taskManager/settings.py — the default config uses SQLite — so this is a no-op functionally and shaves install time + image size.

If someone wants to switch back to MySQL, uncommenting the requirement and re-adding the system deps is straightforward.

Still draft for your review.

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