build(docker): add integration tests, Dockerfile, and docker-compose for packaging

This commit is contained in:
m3tm3re
2026-02-04 20:20:39 +01:00
parent 867b47efd0
commit 1a01b46ed6
6 changed files with 506 additions and 3 deletions

39
Dockerfile Normal file
View File

@@ -0,0 +1,39 @@
# Build stage
FROM python:3.11-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY pyproject.toml .
COPY src/ src/
# Install build tools and build wheel
RUN pip install --no-cache-dir build && \
python -m build --wheel && \
pip install --no-cache-dir --prefix=/install dist/*.whl
# Production stage
FROM python:3.11-slim
WORKDIR /app
# Create non-root user
RUN useradd -m -r appuser && \
chown -R appuser:appuser /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application source
COPY --chown=appuser:appuser src/ src/
USER appuser
EXPOSE 5000
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]