Add Dockerfile and entrypoint for local container use#53
Draft
Reddshift wants to merge 2 commits into
Draft
Conversation
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.
Author
|
Updated: If someone wants to switch back to MySQL, uncommenting the requirement and re-adding the system deps is straightforward. Still draft for your review. |
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.
Summary
Adds a minimal
Dockerfile,entrypoint.sh, and.dockerignoreso the app can be run as a single container for training and integration-testing setups, without changing any application behavior.python:3.12-slimimagemysqlclientwheel build (still inrequirements.txteven though the default SQLite config does not use MySQL)redis-serverbecausetaskManager.settingshard-codesREDIS_HOST = 'localhost'and login uses it for failed-attempt tracking; running it in-container keeps the deployment a single service and avoids changingsettings.pyentrypoint.shrunsmanage.py migrateon every start andloaddata taskManager/fixtures/*only on a fresh database, so restarts preserve session stateOPENROUTER_API_KEYis accepted as an alias forOPENAI_API_KEY(the chatbot already defaults its base URL to OpenRouter)Usage
Optionally pass an API key for the AI assistant:
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 .completesdocker run --rm -p 8000:8000 vtmstarts and prints "Starting development server"http://localhost:8000/taskManager/login/returns the login pagechris/test123(andseth/soccerlover) from the existing fixturesOPENROUTER_API_KEYenv var is picked up by the chatbotNote
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.