From 9ca8b2620a6eae0176e95e1b5cf4a03bb3f8afa9 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Sat, 6 Jan 2024 13:02:18 +0100 Subject: [PATCH] setup permission --- Dockerfile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c80238..d3bab8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,27 @@ FROM deepset/haystack:base-cpu-v1.23.0 COPY requirements.txt . RUN pip install -r requirements.txt +# Set up a new user named "user" with user ID 1000 +RUN useradd -m -u 1000 user + +# Switch to the "user" user +USER user + +# Set home to the user's home directory +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH + +# Set the working directory to the user's home directory +WORKDIR $HOME/app + # copy only the application files in /app # Streamlit does not allow running an app from the root directory -COPY Rock_fact_checker.py app/ -COPY pages app/pages -COPY app_utils app/app_utils -COPY data app/data +COPY --chown=user Rock_fact_checker.py $HOME/app/ +COPY --chown=user pages $HOME/app/pages +COPY --chown=user app_utils $HOME/app/app_utils +COPY --chown=user data $HOME/app/data -WORKDIR app +WORKDIR $HOME/app EXPOSE 8501