From 91a228d3f4500d1658eddef1f6707eb3a6635d1e Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 20 May 2020 14:33:39 -0400 Subject: [PATCH 1/5] Trying to slim down the size of the image --- Dockerfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ff7af23..e0223875 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,18 @@ -FROM python:3.7 +FROM python:3.7-slim -ENV PATH=/root/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin +WORKDIR /app -# install node and yarn -RUN apt-get update -RUN apt-get -y install postgresql-client +COPY Pipfile Pipfile.lock ./ -# config project dir -RUN mkdir /crc-workflow -WORKDIR /crc-workflow +RUN pip install pipenv && \ + apt-get update && \ + apt-get -y install --no-install-recommends gcc python3-dev libssl-dev postgresql-client && \ + pipenv install --deploy --system && \ + apt-get remove -y gcc python3-dev libssl-dev && \ + apt-get autoremove -y -# install python requirements -RUN pip install pipenv -ADD Pipfile /crc-workflow/ -ADD Pipfile.lock /crc-workflow/ -RUN pipenv install --dev +COPY app ./ -# include rejoiner code (gets overriden by local changes) -COPY . /crc-workflow/ - -# run webserver by default ENV FLASK_APP=./crc/__init__.py CMD ["pipenv", "run", "python", "./run.py"] From 97130e504aa46b203afe768e083a359c24d37d41 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 20 May 2020 14:57:03 -0400 Subject: [PATCH 2/5] Adds git --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e0223875..5d3d2d8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY Pipfile Pipfile.lock ./ RUN pip install pipenv && \ apt-get update && \ - apt-get -y install --no-install-recommends gcc python3-dev libssl-dev postgresql-client && \ + apt-get -y install --no-install-recommends gcc python3-dev libssl-dev postgresql-client git && \ pipenv install --deploy --system && \ apt-get remove -y gcc python3-dev libssl-dev && \ apt-get autoremove -y From 865188795f163a94d58397bff6c24aebf89f6d3e Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 20 May 2020 15:04:41 -0400 Subject: [PATCH 3/5] Adds git. Purges apt cache after --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d3d2d8a..f17074a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,12 @@ COPY Pipfile Pipfile.lock ./ RUN pip install pipenv && \ apt-get update && \ - apt-get -y install --no-install-recommends gcc python3-dev libssl-dev postgresql-client git && \ + apt-get install -y --no-install-recommends \ + gcc python3-dev libssl-dev postgresql-client git-core && \ pipenv install --deploy --system && \ apt-get remove -y gcc python3-dev libssl-dev && \ - apt-get autoremove -y + apt-get purge -y --auto-remove && \ + rm -rf /var/lib/apt/lists/ * COPY app ./ From 616a47bd10ad73875af3244fe1e417d24e40e7ee Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 20 May 2020 15:17:03 -0400 Subject: [PATCH 4/5] Fixes file paths --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f17074a2..f8c26e05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,10 +13,10 @@ RUN pip install pipenv && \ apt-get purge -y --auto-remove && \ rm -rf /var/lib/apt/lists/ * -COPY app ./ +COPY . /app -ENV FLASK_APP=./crc/__init__.py -CMD ["pipenv", "run", "python", "./run.py"] +ENV FLASK_APP=/app/crc/__init__.py +CMD ["pipenv", "run", "python", "/app/run.py"] # expose ports EXPOSE 5000 From b91579400045a999735709d8942a999ff36a9532 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 20 May 2020 15:57:54 -0400 Subject: [PATCH 5/5] Fixes more paths. --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8c26e05..160a8f41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,20 +2,21 @@ FROM python:3.7-slim WORKDIR /app -COPY Pipfile Pipfile.lock ./ +COPY Pipfile Pipfile.lock /app/ RUN pip install pipenv && \ apt-get update && \ apt-get install -y --no-install-recommends \ gcc python3-dev libssl-dev postgresql-client git-core && \ - pipenv install --deploy --system && \ + pipenv install --dev && \ apt-get remove -y gcc python3-dev libssl-dev && \ apt-get purge -y --auto-remove && \ rm -rf /var/lib/apt/lists/ * -COPY . /app +COPY . /app/ ENV FLASK_APP=/app/crc/__init__.py +CMD ["pipenv", "run", "flask", "db", "upgrade"] CMD ["pipenv", "run", "python", "/app/run.py"] # expose ports