# Base image with Python 3.12
FROM python:3.12.13-bookworm
# Environment settings
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Working directory
WORKDIR /app
# System dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip
RUN python -m pip install --no-cache-dir --upgrade pip
# Install Python dependencies
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the project
COPY . .
# Expose ports for API and optional Streamlit demo
EXPOSE 8998
EXPOSE 8501
# Default command: start the FastAPI server exposed via uvicorn
CMD ["uvicorn", "scripts.serve_openai_api:app", "--host", "0.0.0.0", "--port", "8998"]
__pycache__/ *.pyc *.pyo *.pyd .Python venv/ env/ build/ develop-eggs/ dist/ downloads/ .eggs/ .eggs-info/ .mypy_cache/ .cache/ pytest_cache/ *.egg-info/ *.pytest_cache/ **/__pycache__/ .dockerignore Dockerfile *.log *.log.* *.sqlite *.db *.tar.gz *.tar *.zip *.ipynb_checkpoints/ images/ dataset/ model/ trainer/ scripts/__pycache__/
Concerns: No non-root user is created; consider adding a USER to drop privileges., The CMD relies on scripts.serve_openai_api:app existing in the repo; ensure the file path and variable name match the actual project structure. Smoke [PASS]: test -f /app/scripts/serve_openai_api.py Smoke [PASS]: test -f /app/requirements.txt Smoke [PASS]: ls -la /app | head -n 20