# Use Python 3.13 as the base image
FROM python:3.13-slim
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app
# Copy requirements files
COPY requirements.txt pyproject.toml ./
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Create a non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
# Expose the port the app runs on
EXPOSE 8000
# Command to run the application
CMD ["python", "server.py"]