Skip to content

Commit 52cb31d

Browse files
authored
Merge pull request #70 from Shuyib/Shuyib-patch-3
Update Dockerfile
2 parents 10f436f + 3540e55 commit 52cb31d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ WORKDIR /app
1111
# ensures that the python output is sent to the terminal without buffering
1212
ENV PYTHONUNBUFFERED=TRUE
1313

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+
1424
# Copy the current directory contents into the container at /app
1525
COPY . /app
1626

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
2233

2334
# Make port 8888 available to the world outside this container
2435
EXPOSE 8888
@@ -28,6 +39,3 @@ VOLUME /app
2839

2940
# Run jupyter when container launches
3041
CMD ["jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root"]
31-
32-
33-

0 commit comments

Comments
 (0)