From b1d26cf0d8e7fd58fd22aca0d2a5761664f763d4 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 12 Aug 2021 09:25:49 +0200 Subject: [PATCH 1/7] added removal of libc-dev after installation of python packages --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index e9c0d5c..fd9c004 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,7 @@ RUN flit install --pth-file # switch back to root to remove header files USER root RUN apk delete python3-dev +RUN apk delete libc-dev RUN apk delete libffi-dev RUN apk delete openssl-dev From 54283b98470ec8c0c29fd9c7cdf6ffab634680d5 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 12 Aug 2021 09:48:57 +0200 Subject: [PATCH 2/7] fixed remove package command --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd9c004..a39276a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,10 +27,10 @@ RUN flit install --pth-file # switch back to root to remove header files USER root -RUN apk delete python3-dev -RUN apk delete libc-dev -RUN apk delete libffi-dev -RUN apk delete openssl-dev +RUN apk del python3-dev +RUN apk del libc-dev +RUN apk del libffi-dev +RUN apk del openssl-dev # switch to the created user to run the application USER deploy From aab263474d70cb640301a727720c52c7021b02b3 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 12 Aug 2021 10:44:05 +0200 Subject: [PATCH 3/7] small change introduced to test ansible deploy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddb0c6c..01d9ca6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Decisions and goals in this project: - have automatic unit test and functional tests, the coverage should be above 90% - complete data migration from the old system -The new system is now online at https://ordr.cpi.imtek.uni-freiburg.de since late April 2020 +The new system is now online at https://ordr.cpi.imtek.uni-freiburg.de since late April 2020. ## Development From 22e13d50de194bdd39d24a399d2144411874c6d8 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 12 Aug 2021 10:56:36 +0200 Subject: [PATCH 4/7] Trying to spead up docker build --- Dockerfile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index a39276a..1fb9a44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,7 @@ FROM python:3.8-alpine # install required packages -RUN apk add --no-cache gcc -RUN apk add --no-cache python3-dev -RUN apk add --no-cache libc-dev -RUN apk add --no-cache libffi-dev -RUN apk add --no-cache openssl -RUN apk add --no-cache openssl-dev +RUN apk add --no-cache gcc libc-dev libffi-dev openssl openssl-dev python3-dev # add user that will be used to install and run the application RUN adduser -D deploy @@ -27,10 +22,7 @@ RUN flit install --pth-file # switch back to root to remove header files USER root -RUN apk del python3-dev -RUN apk del libc-dev -RUN apk del libffi-dev -RUN apk del openssl-dev +RUN apk del libc-dev libffi-dev openssl-dev python3-dev # switch to the created user to run the application USER deploy From 56ed4079dd46865671bb709f7a9aa89edc43408d Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 12 Aug 2021 11:28:44 +0200 Subject: [PATCH 5/7] Added specific group and user id --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1fb9a44..80fd363 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM python:3.8-alpine RUN apk add --no-cache gcc libc-dev libffi-dev openssl openssl-dev python3-dev # add user that will be used to install and run the application -RUN adduser -D deploy +RUN addgroup -g 1000 deploy +RUN adduser -D -u 1000 -G deploy deploy # switch to the created user and install the application USER deploy From 1d01ec856ede1dd0b0a55f45cbf6cc190d4134fe Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 23 Aug 2021 15:21:47 +0200 Subject: [PATCH 6/7] switching from alpine to ubuntu base --- Dockerfile | 29 +++++++++++++++++++++-------- Dockerfile alpine | 30 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 Dockerfile alpine diff --git a/Dockerfile b/Dockerfile index 80fd363..540dab8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,24 @@ -FROM python:3.8-alpine +FROM ubuntu:latest -# install required packages -RUN apk add --no-cache gcc libc-dev libffi-dev openssl openssl-dev python3-dev +# update to the latest packages +ENV DEBIAN_FRONTEND="noninteractive" +RUN apt-get update && apt-get upgrade -y # add user that will be used to install and run the application -RUN addgroup -g 1000 deploy -RUN adduser -D -u 1000 -G deploy deploy +RUN groupadd -g 1000 deploy +RUN useradd -u 1000 -g deploy deploy + +# install required packages for debugging +# RUN apt-get install -y vim curl lsof + + +# +# CUSTOM PART IS BELOW HERE +# + + +# install required packages +RUN apt-get install -y python3 # switch to the created user and install the application USER deploy @@ -22,9 +35,9 @@ RUN pip install -r requirements.txt RUN flit install --pth-file # switch back to root to remove header files -USER root -RUN apk del libc-dev libffi-dev openssl-dev python3-dev +#USER root +#RUN apk del libc-dev libffi-dev openssl-dev python3-dev # switch to the created user to run the application -USER deploy +#USER deploy CMD ["gunicorn", "--paster", "/app/production.ini", "-b", "0.0.0.0:8000"] diff --git a/Dockerfile alpine b/Dockerfile alpine new file mode 100644 index 0000000..80fd363 --- /dev/null +++ b/Dockerfile alpine @@ -0,0 +1,30 @@ +FROM python:3.8-alpine + +# install required packages +RUN apk add --no-cache gcc libc-dev libffi-dev openssl openssl-dev python3-dev + +# add user that will be used to install and run the application +RUN addgroup -g 1000 deploy +RUN adduser -D -u 1000 -G deploy deploy + +# switch to the created user and install the application +USER deploy +ENV PATH "$PATH:/home/deploy/.local/bin" + +COPY . /app +WORKDIR /app + +RUN pip install --upgrade pip +RUN pip install gunicorn +RUN pip install wheel + +RUN pip install -r requirements.txt +RUN flit install --pth-file + +# switch back to root to remove header files +USER root +RUN apk del libc-dev libffi-dev openssl-dev python3-dev + +# switch to the created user to run the application +USER deploy +CMD ["gunicorn", "--paster", "/app/production.ini", "-b", "0.0.0.0:8000"] From 1f648473a40f60d275c0fa5a08f37b944407c623 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 23 Aug 2021 15:34:29 +0200 Subject: [PATCH 7/7] switching from alpine to ubuntu base --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 540dab8..90e0aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && apt-get upgrade -y # add user that will be used to install and run the application RUN groupadd -g 1000 deploy -RUN useradd -u 1000 -g deploy deploy +RUN useradd -m -u 1000 -g deploy deploy # install required packages for debugging # RUN apt-get install -y vim curl lsof @@ -18,7 +18,7 @@ RUN useradd -u 1000 -g deploy deploy # install required packages -RUN apt-get install -y python3 +RUN apt-get install -y python3 python3-pip # switch to the created user and install the application USER deploy