24 lines
658 B
Docker
24 lines
658 B
Docker
FROM python:3.12-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY . .
|
|
RUN mkdir -p /app/data
|
|
EXPOSE 8000
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
# Test image: same app plus dev dependencies, runs the suite in isolation.
|
|
FROM base AS test
|
|
|
|
COPY requirements-dev.txt ./
|
|
RUN pip install --no-cache-dir -r requirements-dev.txt
|
|
ENV SECRET_KEY=test-only-secret-key \
|
|
DATABASE_URL=sqlite:///./data/test.db \
|
|
INITIAL_ADMIN_PASSWORD=test-only-password
|
|
CMD ["pytest", "-ra"]
|