Initial scaffold: FastAPI micro-services API (forge + founder)

This commit is contained in:
2026-06-05 02:48:04 +02:00
parent 350143ceb4
commit b2973b63ee
5 changed files with 79 additions and 220 deletions
+3 -22
View File
@@ -1,31 +1,12 @@
# ---- Build stage ----
FROM python:3.12-slim AS builder
FROM python:3.11-slim
WORKDIR /app
# Install dependencies in a venv
COPY requirements.txt .
RUN python -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# ---- Runtime stage ----
FROM python:3.12-slim AS runtime
WORKDIR /app
# Copy virtualenv from builder
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Copy application code
COPY app/ ./app/
# Create data dir for SQLite
RUN mkdir -p /app/data && chmod 777 /app/data
COPY . .
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')" || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]