-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,20 @@ | ||
# Dockerfile | ||
FROM continuumio/miniconda3:latest | ||
|
||
# Create non-root user similar to jupyter's default 'jovyan' | ||
RUN useradd -ms /bin/bash jovyan | ||
USER root | ||
|
||
# Copy environment files | ||
COPY environment.yml /tmp/environment.yml | ||
COPY apt.txt /tmp/apt.txt | ||
FROM jupyter/minimal-notebook:latest | ||
|
||
# Install system dependencies | ||
COPY apt.txt /tmp/apt.txt | ||
USER root | ||
RUN apt-get update && \ | ||
grep -v '^#' /tmp/apt.txt | xargs apt-get install -y && \ | ||
xargs apt-get install -y < /tmp/apt.txt && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Create conda environment and install jupyterlab | ||
RUN conda env create -f /tmp/environment.yml && \ | ||
conda install -n uwgda-image-living -c conda-forge jupyterlab && \ | ||
conda clean -afy | ||
# Switch back to jovyan user | ||
USER ${NB_UID} | ||
|
||
# Make RUN commands use the new conda environment | ||
SHELL ["conda", "run", "-n", "uwgda-image-living", "/bin/bash", "-c"] | ||
|
||
# Set up conda env activation | ||
RUN echo "conda activate uwgda-image-living" >> ~/.bashrc | ||
|
||
# Add conda environment to PATH and set CONDA_DEFAULT_ENV | ||
ENV PATH /opt/conda/envs/uwgda-image-living/bin:$PATH | ||
ENV CONDA_DEFAULT_ENV uwgda-image-living | ||
|
||
# Set up work directory and permissions | ||
WORKDIR /home/jovyan | ||
RUN chown -R jovyan:jovyan /home/jovyan | ||
|
||
# Switch to non-root user | ||
USER jovyan | ||
|
||
# Expose Jupyter port | ||
EXPOSE 8888 | ||
# Copy environment.yml | ||
COPY environment.yml /tmp/environment.yml | ||
|
||
# Start JupyterLab using conda run to ensure we're in the right environment | ||
ENTRYPOINT ["conda", "run", "-n", "uwgda-image-living"] | ||
CMD ["jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--ServerApp.token=''"] | ||
# Create conda environment | ||
RUN mamba env update -n base -f /tmp/environment.yml && \ | ||
mamba clean --all -f -y |