joelgrus-data-science-from-scratch
SUCCESS
6m 12s
History Source
SummaryIterations1Transcript5Dockerfile
Dockerfile30 lines · 945 chars
FROM python:3.12.13-bookworm

# Basic Python environment configuration
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/workspace

# System dependencies needed to build some wheels (e.g., matplotlib, pillow)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        build-essential gcc \
        libjpeg-dev zlib1g-dev libpng-dev libfreetype6-dev libatlas-base-dev \
    && rm -rf /var/lib/apt/lists/*

# Create and set the working directory
WORKDIR /workspace

# Install Python dependencies first (cache-friendly)
COPY requirements.txt .
RUN python -m pip install --upgrade pip setuptools wheel && \
    python -m pip install --no-cache-dir -r requirements.txt

# Copy the repository code into the image
COPY . .

# Ensure the repo root is on PYTHONPATH so modules can be imported from anywhere
ENV PYTHONPATH=/workspace

# Do not set a default command to avoid shell-quoting issues with test harness