From e5a5acdde2ff88a2cd70b1939a70d1a7499c0b77 Mon Sep 17 00:00:00 2001 From: Davide Fusca Date: Wed, 24 Apr 2024 22:28:45 +0200 Subject: [PATCH] Update Dockerfile --- core/Dockerfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/Dockerfile b/core/Dockerfile index 4072a696a..a0ceb95ba 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -1,6 +1,11 @@ FROM python:3.10.11-slim-bullseye +ARG USER_ONBUILD=cat +ARG UID_ONBUILD=1001 +ARG GROUP_ONBUILD=cat +ARG GID_ONBUILD=1001 + ### SYSTEM SETUP ### RUN apt-get -y update && apt-get install -y curl build-essential fastjar libmagic-mgc libmagic1 mime-support && \ apt-get clean && \ @@ -19,6 +24,19 @@ RUN pip install -U pip && \ pip install --no-cache-dir . &&\ python3 -c "import nltk; nltk.download('punkt');nltk.download('averaged_perceptron_tagger')" +### ADD USER ### +RUN groupadd -g ${GID_ONBUILD} ${GROUP_ONBUILD} && \ + useradd -m -u ${UID_ONBUILD} -g ${GROUP_ONBUILD} ${USER_ONBUILD} \ + && chown -R ${GROUP_ONBUILD}:${USER_ONBUILD} /app + +USER ${GROUP_ONBUILD}:${USER_ONBUILD} + +### CREATE HOME LOCAL BIN FOLDER IF NOT EXIST ### +RUN mkdir -p /home/${USER_ONBUILD}/.local/bin + +### ADD HOME LOCAL BIN FOLDER TO THE PATH ### +ENV PATH="/home/${USER_ONBUILD}/.local/bin:${PATH}" + ### COPY CAT CODE INSIDE THE CONTAINER (so it can be run standalone) ### COPY ./cat /app/cat