From 15c494e44646f0667f8d33bc0cf88d8bba9712cb Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 19 Mar 2020 18:47:55 -0500 Subject: [PATCH 1/3] Fixes #28 - Add dockerfile, update Readme --- Dockerfile | 16 ++++++++++++++++ README.md | 14 ++++++++++++++ requirements/prod.txt | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a74b9cbc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:18.04 + +RUN apt-get update && \ + apt-get install -y python3 python3-pip + +WORKDIR /usr/src/app + +COPY . . + +RUN pip3 install -r requirements/prod.txt + +ENV FLASK_APP time_tracker_api + +EXPOSE 5000 + +CMD ["gunicorn", "-b 0.0.0.0:5000", "run:app"] \ No newline at end of file diff --git a/README.md b/README.md index ea331484..78c5cbed 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,20 @@ as well as its correspondent options. python cli.py gen_swagger_json -f ~/Downloads/swagger.json ``` +## Run as docker container + +1. Build image +```bash +docker build -t time_tracker_api:local . +``` + +2. Run app +```bash +docker run -p 5000:5000 time_tracker_api:local +``` + +3. Visit `0.0.0.0:5000` + ## Built with - [Python version 3](https://www.python.org/download/releases/3.0/) as backend programming language. Strong typing for the win. diff --git a/requirements/prod.txt b/requirements/prod.txt index df3d5cfc..ef51774e 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -15,5 +15,8 @@ gunicorn==20.0.4 #Swagger support for Restful API flask-restplus==0.13.0 +#Mocking +Faker==4.0.2 + #CLI support Flask-Script==2.0.6 \ No newline at end of file From 263100d69a18e4635778f3ebf1556b17b00c303a Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 19 Mar 2020 20:35:44 -0500 Subject: [PATCH 2/3] Fixes #28 - fix Readme --- Dockerfile | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a74b9cbc..264e1e53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ ENV FLASK_APP time_tracker_api EXPOSE 5000 -CMD ["gunicorn", "-b 0.0.0.0:5000", "run:app"] \ No newline at end of file +CMD ["gunicorn", "-b 0.0.0.0:5000", "run:app"] diff --git a/README.md b/README.md index 78c5cbed..539250c2 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ docker build -t time_tracker_api:local . docker run -p 5000:5000 time_tracker_api:local ``` -3. Visit `0.0.0.0:5000` +3. Visit `127.0.0.1:5000` ## Built with - [Python version 3](https://www.python.org/download/releases/3.0/) as backend programming language. Strong typing for From 2f095e12e24f9a73d58cc2993bf9a63898dd6fd3 Mon Sep 17 00:00:00 2001 From: roberto Date: Fri, 20 Mar 2020 11:41:37 -0500 Subject: [PATCH 3/3] Fixes #28 - change ubuntu for alpine in docker --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 264e1e53..158ed18f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,4 @@ -FROM ubuntu:18.04 - -RUN apt-get update && \ - apt-get install -y python3 python3-pip +FROM python:3.8-alpine WORKDIR /usr/src/app