Skip to content

Commit d49cd8c

Browse files
authored
Update Dockerfile
1 parent 37330fb commit d49cd8c

File tree

1 file changed

+11
-36
lines changed

1 file changed

+11
-36
lines changed

Dockerfile

+11-36
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,20 @@
11
# Dockerfile
2-
FROM continuumio/miniconda3:latest
3-
4-
# Create non-root user similar to jupyter's default 'jovyan'
5-
RUN useradd -ms /bin/bash jovyan
6-
USER root
7-
8-
# Copy environment files
9-
COPY environment.yml /tmp/environment.yml
10-
COPY apt.txt /tmp/apt.txt
2+
FROM jupyter/minimal-notebook:latest
113

124
# Install system dependencies
5+
COPY apt.txt /tmp/apt.txt
6+
USER root
137
RUN apt-get update && \
14-
grep -v '^#' /tmp/apt.txt | xargs apt-get install -y && \
8+
xargs apt-get install -y < /tmp/apt.txt && \
159
apt-get clean && \
1610
rm -rf /var/lib/apt/lists/*
1711

18-
# Create conda environment and install jupyterlab
19-
RUN conda env create -f /tmp/environment.yml && \
20-
conda install -n uwgda-image-living -c conda-forge jupyterlab && \
21-
conda clean -afy
12+
# Switch back to jovyan user
13+
USER ${NB_UID}
2214

23-
# Make RUN commands use the new conda environment
24-
SHELL ["conda", "run", "-n", "uwgda-image-living", "/bin/bash", "-c"]
25-
26-
# Set up conda env activation
27-
RUN echo "conda activate uwgda-image-living" >> ~/.bashrc
28-
29-
# Add conda environment to PATH and set CONDA_DEFAULT_ENV
30-
ENV PATH /opt/conda/envs/uwgda-image-living/bin:$PATH
31-
ENV CONDA_DEFAULT_ENV uwgda-image-living
32-
33-
# Set up work directory and permissions
34-
WORKDIR /home/jovyan
35-
RUN chown -R jovyan:jovyan /home/jovyan
36-
37-
# Switch to non-root user
38-
USER jovyan
39-
40-
# Expose Jupyter port
41-
EXPOSE 8888
15+
# Copy environment.yml
16+
COPY environment.yml /tmp/environment.yml
4217

43-
# Start JupyterLab using conda run to ensure we're in the right environment
44-
ENTRYPOINT ["conda", "run", "-n", "uwgda-image-living"]
45-
CMD ["jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--ServerApp.token=''"]
18+
# Create conda environment
19+
RUN mamba env update -n base -f /tmp/environment.yml && \
20+
mamba clean --all -f -y

0 commit comments

Comments
 (0)