Start by pulling down a debian base build.
docker pull debian:8.0 .Creating a
Dockerfile for a base build to a python flask app. based on debian 8
build the docker base image. the
-t gives the build a name, the
--rm=true means “Remove intermediate containers after a successful build”, the
--no-cache=false means “Do not use cache when building the image”. the dot means look for the
Dockerfile in the current folder. using the flags together means that all of the steps in the docker build is done every time since i want to make the full docker build. Not just from a commit a few steps in to the build.
build the flask app docker image based on the base docker build foobar.
building the api docker image. the assumption is that there is a folder named app in the same folder as the
Dockerfile. This folder contains the api and the support modules and files needed for the api. ‘COPY app* /opt/app’ will copy all files in the app folder and copy them to the /opt/app folder in the docker image. using the
ENTRYPOINT makes the docker image start the api on start of the image.
Now you can start the docker image named api and the api will be started when the docker image is started.