Think of this as two things:
- The Nginx/uWSGI/Flask/Conda (specifically the Conda environment) can take forever to build/update, hence top level (this project) builds the base image
- The
example/
serves as the app itself. If your project was inexample/
then you use thatDockerfile
to copy over your app files
So to reiterate:
- Top level: base image
example/
: your app- dogs: 🐶
Due to conda's preference for its own Python repository (instead of pypi) & the out-of-date problems assoc. with this, we use conda for dependencies which are only available there. Conda also lacks channel pinning (or hash pinning for that matter) and thus, we try to keep everything out of conda if possible.
A standard pip requirements.txt file is the preferred way to adding Python deps.
Note: if you activate a conda env, then do a pip install
to create an update
with conda env export
, conda has a tendency to add your pypi dependency into
its own list of anaconda cloud dependencies instead. Try to ensure that we're
pulling from pypi instead of anaconda cloud when updating this repo.
The Dockerfile will build the conda env first, then use pip to install your requirements.txt deps. inside that env. This image is what's shipped.
- Change the app/environment.yml file.
- Change the app/requirements.txt file.
docker build -t baesimage .
cd example/
docker build -t myimage .
docker run -d --name mycontainer -p 80:80 myimage