From 7a2aace6cc74c3dafbd68f35741743e49ff1f8b5 Mon Sep 17 00:00:00 2001 From: Alex Kanitz <alexander.kanitz@unibas.ch> Date: Mon, 19 Dec 2022 08:42:11 +0000 Subject: [PATCH] build: add Dockerfile --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb44f01 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM python:3.11.1-slim-bullseye + +# MAINTAINER add_maintainer + +# set names for user, group and user home +ARG USER="bioc" +ARG GROUP="bioc" +ARG WORKDIR="/home/${USER}" + +# create user, group, user home & makes the user and group +# the owner of the user home +RUN mkdir -p $WORKDIR \ + && groupadd -r $GROUP \ + && useradd --no-log-init -r -g $GROUP $USER \ + && chown -R ${USER}:${GROUP} $WORKDIR \ + && chmod 700 $WORKDIR + +# set the user, make sure the location where pip +# installs binaries/executables is part of the $PATH +# and set the working directory to the user's home +USER $USER +ENV PATH="${WORKDIR}/.local/bin:${PATH}" +WORKDIR $WORKDIR + +# copy entire content of the current directory to the +# working directory; ensure that this does not contain any +# files that you don't want to have end up in the Docker +# image, especially not any secrets! +# use `.dockerignore` to set files that you do NOT want +# Docker to copy +COPY --chown=${USER}:${GROUP} . $WORKDIR + +# install app and development dependencies +# assumes that dependencies in `requirements.txt` are +# automatically installed when installing the app; if +# that is not the case, they need to be installed +# _before_ installing the app +RUN pip install . \ + && pip install --no-cache-dir -r requirements-dev.txt + +# set default command; optional +CMD ["readsequencer"] -- GitLab