@@ -11,14 +11,25 @@ WORKDIR /app
11
11
# ensures that the python output is sent to the terminal without buffering
12
12
ENV PYTHONUNBUFFERED=TRUE
13
13
14
+ # Update and upgrade packages, create a virtual environment, activate it and install the required libraries
15
+ RUN apt-get update && apt-get upgrade -y && \
16
+ apt-get install -y --no-install-recommends \
17
+ build-essential && \
18
+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
19
+ python3 -m venv phylo-env && \
20
+ . phylo-env/bin/activate && \
21
+ pip --no-cache-dir install --upgrade pip && \
22
+ pip --no-cache-dir install --requirement requirements.txt
23
+
14
24
# Copy the current directory contents into the container at /app
15
25
COPY . /app
16
26
17
- # create a virtual environment, activate it and install the required libraries
18
- RUN python3 -m venv phylo-env &&\
19
- . phylo-env/bin/activate &&\
20
- pip --no-cache-dir install --upgrade pip &&\
21
- pip --no-cache-dir install --requirement requirements.txt
27
+ # Create a non-root user
28
+ RUN useradd -m phylo-user && \
29
+ chown -R phylo-user:phylo-user /app
30
+
31
+ # Switch to the non-root user
32
+ USER phylo-user
22
33
23
34
# Make port 8888 available to the world outside this container
24
35
EXPOSE 8888
@@ -28,6 +39,3 @@ VOLUME /app
28
39
29
40
# Run jupyter when container launches
30
41
CMD ["jupyter" , "notebook" , "--ip='0.0.0.0'" , "--port=8888" , "--no-browser" , "--allow-root" ]
31
-
32
-
33
-
0 commit comments