# Start from the official Jupyter docker-stacks image for PySpark FROM jupyter/pyspark-notebook:latest # Switch to root to install OS-level packages if needed USER root # (Optional) Install extra system dependencies here, e.g.: # RUN apt-get update && apt-get install -y vim && rm -rf /var/lib/apt/lists/* # Switch back to the 'jovyan' user (the default user in jupyter docker-stacks) USER $NB_UID # Create a working directory (already set to /home/jovyan by default). # We'll explicitly set it here for clarity. WORKDIR /home/jovyan/work # Copy any additional Python packages you need COPY requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r /tmp/requirements.txt || true # Copy notebooks and data into the container COPY notebooks/ notebooks/ COPY data/ data/ # Switch back to 'jovyan' user (the default in the jupyter/docker-stacks images) USER $NB_UID # Make sure 'jovyan' user owns these files/folders #RUN chown -R jovyan:users /home/jovyan/work # Expose Jupyter's default port EXPOSE 8888 # Run Jupyter Notebook, disabling token & password, allow root access CMD start.sh jupyter notebook \ --ip=0.0.0.0 --port=8888 --no-browser \ --allow-root\ --NotebookApp.token= --NotebookApp.password= \ --NotebookApp.allow_origin=* --NotebookApp.disable_check_xsrf=True \ --NotebookApp.allow_remote_access=True \ --NotebookApp.tornado_settings='{"headers":{"Content-Security-Policy":"frame-ancestors *","X-Frame-Options":"ALLOWALL"}}'