FROM python:3.11-slim

WORKDIR /app

# Copy source code first
COPY . .

# Install dependencies and the application
# The lock file includes the current project as editable, so we install everything together
RUN pip install --no-cache-dir -r requirements.lock

# Create a non-root user
ARG UID=10001
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "/nonexistent" \
    --shell "/sbin/nologin" \
    --no-create-home \
    --uid "${UID}" \
    appuser

USER appuser

# Set the entrypoint
ENTRYPOINT ["modelaudit"]
CMD ["--help"] 
