Skip to content

Commit 9bb4fc1

Browse files
authored
Update Dockerfile
1 parent 44f161c commit 9bb4fc1

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

Dockerfile

+34-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,52 @@
11
# Dockerfile
22
FROM continuumio/miniconda3:latest
33

4+
# Create non-root user similar to jupyter's default 'jovyan'
5+
RUN useradd -ms /bin/bash jovyan
6+
USER root
7+
48
# Copy environment files
59
COPY environment.yml /tmp/environment.yml
610
COPY apt.txt /tmp/apt.txt
711

812
# Install system dependencies
913
RUN apt-get update && \
10-
xargs apt-get install -y < /tmp/apt.txt && \
14+
grep -v '^#' /tmp/apt.txt | xargs apt-get install -y && \
1115
apt-get clean && \
1216
rm -rf /var/lib/apt/lists/*
1317

1418
# Create conda environment
1519
RUN conda env create -f /tmp/environment.yml && \
1620
conda clean -afy
1721

22+
# Add jupyterlab to environment
23+
RUN conda install -n gda -c conda-forge jupyterlab && \
24+
conda clean -afy
25+
1826
# Add conda environment to PATH
19-
ENV PATH /opt/conda/envs/$(head -1 /tmp/environment.yml | cut -d' ' -f2)/bin:$PATH
27+
ENV PATH /opt/conda/envs/gda/bin:$PATH
28+
29+
# Set up work directory and permissions
30+
WORKDIR /home/jovyan
31+
RUN chown -R jovyan:jovyan /home/jovyan
32+
33+
# Switch to non-root user
34+
USER jovyan
35+
36+
# Expose Jupyter port
37+
EXPOSE 8888
38+
39+
# Start JupyterLab
40+
CMD ["jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--ServerApp.token=''"]
2041

21-
# Set the shell to bash
22-
SHELL ["/bin/bash", "-c"]
23-
ENTRYPOINT ["bash"]
42+
---
43+
# docker-compose.yml
44+
version: "3.9"
45+
services:
46+
jupyterlab:
47+
image: "ghcr.io/uw-gda/uwgda-image-living:latest"
48+
ports:
49+
- "8888:8888"
50+
volumes:
51+
- ${PWD}:/home/jovyan
52+
user: "1000:1000" # This matches typical Linux UID:GID for first user

0 commit comments

Comments
 (0)