From d2eb5724bc143fdeb4eedd799df8d641e9cd3946 Mon Sep 17 00:00:00 2001 From: Jaimie Imrie Date: Mon, 10 Sep 2018 08:15:59 -0700 Subject: [PATCH 1/3] Added Dockerfile --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb2e5f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +#Each command creates a separate layer + +#Base subsquent layers on alpine:3.8 +FROM alpine:3.8 + +#Create the /opt and /opt/app directories +RUN mkdir /opt && mkdir /opt/app + +#Install python 3 and pip +RUN apk add --no-cache python3 py-pip + +#Add the requirements file to /opt/app +ADD requirements.txt /opt/app + +#pip install depedencies +RUN pip install -r /opt/app/requirements.txt + +#Add the flask app to /opt/app +ADD app.py /opt/app/app.py + +#Devleopment flask runs on port 5000. Expose. +EXPOSE 5000 + +#Define the comamned to execute on container start. Must bind to local loopback not localhost. +CMD flask run --host=0.0.0.0 From a9eef54533ebb80c4c2255f17b32d28d278c56f3 Mon Sep 17 00:00:00 2001 From: Jaimie Imrie Date: Wed, 12 Sep 2018 08:37:03 -0700 Subject: [PATCH 2/3] Comment correction --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb2e5f6..8cd3fdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN apk add --no-cache python3 py-pip ADD requirements.txt /opt/app #pip install depedencies -RUN pip install -r /opt/app/requirements.txt +RUN pip3 install -r /opt/app/requirements.txt #Add the flask app to /opt/app ADD app.py /opt/app/app.py @@ -21,5 +21,8 @@ ADD app.py /opt/app/app.py #Devleopment flask runs on port 5000. Expose. EXPOSE 5000 -#Define the comamned to execute on container start. Must bind to local loopback not localhost. +#Set the flask app env var +ENV FLASK_APP=/opt/app/app.py + +#Define the comamned to execute on container start. Must bind to all, not localhost or loopback CMD flask run --host=0.0.0.0 From 8993422eb92398c5e70287d9ea16bf14d37ed5a1 Mon Sep 17 00:00:00 2001 From: Jaimie Imrie Date: Fri, 21 Sep 2018 22:37:57 -0700 Subject: [PATCH 3/3] Dockerfile update --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8cd3fdb..be8f3ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,13 +10,13 @@ RUN mkdir /opt && mkdir /opt/app RUN apk add --no-cache python3 py-pip #Add the requirements file to /opt/app -ADD requirements.txt /opt/app +COPY requirements.txt /opt/app #pip install depedencies RUN pip3 install -r /opt/app/requirements.txt #Add the flask app to /opt/app -ADD app.py /opt/app/app.py +COPY app.py /opt/app/app.py #Devleopment flask runs on port 5000. Expose. EXPOSE 5000