Master py3 docker 00#867
Open
martin-bts wants to merge 6 commits into
Open
Conversation
added 6 commits
August 23, 2020 22:56
* provide default for dj_database_url.config() sqlite://<PROJECT_ROOT>/askbot.sqlite * enforce TIMEOUT: 6000 * remove /askbot/ segment from MEDIA_ROOT
* should be deployed into the same dir as settings.py * current settings.py does reference it.
* .dockerignore improves the build process * augment_settings.py will be appended to settings.py and is meant to provide some degrees of freedom for container creators * uwsgi.txt is a config snipped we want to use with the (current) base image tiangolo/uwsgi-nginx
* build container with docker build -t TAG_YOUR_STUFF . * docker run TAG_YOUR_STUFF will start an Askbot container using locmem and SQLite * exposes port 8000 by default, change with env var LISTEN_PORT * use existing database by providing the env var DATABASE_URL, e.g. docker run \ -e DATABASE_URL="postgres://askbot:askB0T@1.2.3.4:5432/my_askbot"\ TAG_YOUR_STUFF -d * use existing Redis cluster by providing the env vars ASKBOT_CACHE and CACHE_NODES, e.g. docker run \ -e ASKBOT_CACHE="redis" -e CACHE_NODES="1.2.3.4:6379,2.3.4.5:6379" \ TAG_YOUR_STUFF -d * overwrite admin by providing the env var ADMIN_PASSWORD, e.g. docker run \ -e ADMIN_PASSWORD="supersecret" \ TAG_YOUR_STUFF -d * Don't forget to provide your own SECRET_KEY, e.g. docker run \ -e SECRET_KEY="$(openssl rand 14 | base64)" \ TAG_YOUR_STUFF -d * To persist staticfiles and upfiles use mounts, e.g. docker run \ --mount type=bind,source=/p/a/th,destination=/askbot-site/static \ --mount type=bind,source=/p/a/th,destination=/askbot-site/upfiles \ TAG_YOUR_STUFF -d
| # Static files are stored in **/askbot_site/static** . I'd recommend to make it a kubernetes volume. | ||
|
|
||
| # Stage 0 | ||
| FROM tiangolo/uwsgi-nginx:python3.8-alpine |
There was a problem hiding this comment.
Suggested change
| FROM tiangolo/uwsgi-nginx:python3.8-alpine | |
| FROM tiangolo/uwsgi-nginx:python3.9-alpine |
3.8 would be downgrade
|
|
||
|
|
||
| # Stage 1 | ||
| FROM tiangolo/uwsgi-nginx:python3.8-alpine |
There was a problem hiding this comment.
Suggested change
| FROM tiangolo/uwsgi-nginx:python3.8-alpine | |
| FROM tiangolo/uwsgi-nginx:python3.9-alpine |
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.
This is essentially how I have been building and running dockerized Askbot for the past year.
Askbot has a few dependencies which require a compiler, so I moved to a two-staged build, where the first stage builds all required packages, so that the second stage merely installs whl-files and does not need a build environment.
The main image is built in three steps:
askbot/deployment.For a first glimpse, one should be able to simply
For best results, #864 is applied first. I moved to Python 3.8 a few months ago, but I know 3.7 works just as well. For options see commit message of 8a3f5f3