Files
mals/Dockerfile

29 lines
710 B
Docker

FROM python:3.12-slim
# Install curl for healthcheck
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
# Copy dependency files first (layer caching)
COPY pyproject.toml uv.lock* ./
# Install dependencies (no dev extras)
RUN uv sync --frozen --no-dev 2>/dev/null || uv sync --no-dev
# Copy source
COPY src/ ./src/
COPY alembic/ ./alembic/
COPY alembic.ini ./
# Run as non-root
RUN adduser --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
EXPOSE 8421
CMD ["uv", "run", "uvicorn", "mals.main:app", "--host", "0.0.0.0", "--port", "8421"]