jupy-lab / Dockerfile
Ramses II
auto msg
e9576fd
raw
history blame
1.73 kB
FROM jupyter/scipy-notebook
# Create a user with ID 1000
RUN useradd -m -u 1000 user
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory
WORKDIR $HOME/app
# Install system dependencies
USER root
RUN apt-get update && apt-get install -y \
wget \
nginx \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Switch back to the user
USER user
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip
# Copy requirements and install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
# Copy static files
COPY --chown=user public $HOME/app/public
# Copy configuration files
COPY --chown=user jupyter_config.py $HOME/.jupyter/jupyter_config.py
COPY --chown=user nginx.conf $HOME/nginx.conf
COPY --chown=user entrypoint.sh $HOME/entrypoint.sh
# Make entrypoint executable
RUN chmod +x $HOME/entrypoint.sh
# Create necessary directories for Nginx
USER root
RUN mkdir -p /var/lib/nginx/body /var/lib/nginx/fastcgi \
/var/lib/nginx/proxy /var/lib/nginx/scgi \
/var/lib/nginx/uwsgi /var/log/nginx \
&& chown -R user:user /var/lib/nginx /var/log/nginx /var/run /run \
&& chmod 755 /var/lib/nginx /var/run /run
# Create Nginx log files
RUN touch /var/log/nginx/error.log /var/log/nginx/access.log \
&& chown user:user /var/log/nginx/error.log /var/log/nginx/access.log
# Create a directory for persistent data
RUN mkdir -p /data && chown user:user /data && chmod 777 /data
USER user
# Expose ports
EXPOSE 8888 7860
# Set environment variables
ENV JUPYTERLAB_PORT=8888 \
NGINX_PORT=7860
# Run the entrypoint script
ENTRYPOINT ["$HOME/entrypoint.sh"]