jupy-lab / Dockerfile
Ramses II
auto msg
b26378c
raw
history blame
1.73 kB
FROM jupyter/scipy-notebook
# Set the working directory to /app
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Copy static files
COPY public /app/public
# Switch to root user to install system packages and set permissions
USER root
# Install the dependencies
RUN apt-get update && apt-get install -y wget nginx && pip install -r requirements.txt
# Copy the configuration files and entrypoint script
COPY jupyter_config.py /etc/jupyter/jupyter_config.py
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh /app/entrypoint.sh
# Set the entrypoint script as executable
RUN chmod +x /app/entrypoint.sh
# Create necessary directories and set permissions for Nginx
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 ${NB_UID}:${NB_GID} /var/lib/nginx /var/log/nginx /var/run /run \
&& chmod 755 /var/lib/nginx /var/run /run
# Ensure Nginx has permissions to write to log directory and PID file
RUN touch /var/log/nginx/error.log /var/log/nginx/access.log /run/nginx.pid \
&& chown -R ${NB_UID}:${NB_GID} /var/log/nginx /run/nginx.pid
# Set the permissions for the app directory to the existing user
RUN chown -R ${NB_UID}:${NB_GID} /app
# Switch back to the original user
USER ${NB_UID}
# Set the working directory for the user
WORKDIR /home/${NB_USER}/app
# Expose the port 8888 for JupyterLab
EXPOSE 8888
# Expose the port 7860 for Nginx
EXPOSE 7860
# Set the environment variables
ENV JUPYTERLAB_PORT=8888
ENV JUPYTERLAB_TOKEN=your_secret_token
ENV NGINX_PORT=7860
# Run the entrypoint script when the container starts
ENTRYPOINT ["/app/entrypoint.sh"]