File size: 1,330 Bytes
c0616b4 511bc62 c0616b4 6992e29 c0616b4 da5c857 c0616b4 6992e29 da5c857 6992e29 da5c857 f1bd50d da5c857 c0616b4 0d321d4 da5c857 7182945 da5c857 7182945 c0616b4 ecd62c6 c0616b4 ea37cb1 da5c857 6992e29 c0616b4 da5c857 6992e29 ecd62c6 3b6b10b ecd62c6 3b6b10b c0616b4 da5c857 6992e29 da5c857 ea37cb1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
FROM jupyter/scipy-notebook:latest
# Set the working directory to /app
WORKDIR /app
# Copy the requirements file and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy static files
COPY public /app/public
# Switch to root user to install system packages and set permissions
USER root
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
nginx \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 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
RUN mkdir -p /data /var/log/nginx /var/log/pods && \
chown -R ${NB_UID}:${NB_GID} /app /data /var/log/nginx /var/log/pods /etc/nginx/nginx.conf && \
chmod 755 /data
# Switch back to the original user
USER ${NB_UID}
# Set the working directory for the user
WORKDIR /data
# Mount the secret
RUN --mount=type=secret,id=JUPYTER_TOKEN,mode=0444,required=true \
cat /run/secrets/JUPYTER_TOKEN
# Expose the port for Nginx
EXPOSE 7860
# Run the entrypoint script when the container starts
ENTRYPOINT ["/app/entrypoint.sh"] |