FROM python:3.12.13-bookworm
# Set working directory inside the container
WORKDIR /workspace
# Copy repository contents
COPY . /workspace
# Ensure we have an up-to-date pip
RUN python -m pip install --no-cache-dir --upgrade pip
# Build step: generate a simple index.html listing repository files
RUN python - <<'PY'
import os
files_dir = "files"
lines = ['<html><head><meta charset="UTF-8"></head><body><h1>Live Machine Learning Class Notes</h1><ul>']
if os.path.isdir(files_dir):
for fname in sorted(os.listdir(files_dir)):
full = os.path.join(files_dir, fname)
if os.path.isfile(full):
lines.append(f'<li><a href="{full}">{fname}</a></li>')
lines.append('</ul></body></html>')
with open('index.html', 'w', encoding='utf-8') as f:
f.write('\n'.join(lines))
PY
# Expose port for a lightweight HTTP server to access docs/notebooks
EXPOSE 8000
# Serve the repository contents over HTTP for quick inspection
CMD ["python", "-m", "http.server", "8000"]