From 1d01ec856ede1dd0b0a55f45cbf6cc190d4134fe Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 23 Aug 2021 15:21:47 +0200 Subject: [PATCH] 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"]