Add Docker Compose setup
Multi-stage Dockerfile builds the React frontend then serves everything from a single Python container. settings.json persists via a named volume. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
|||||||
|
FROM node:22-alpine AS build
|
||||||
|
WORKDIR /app/frontend
|
||||||
|
COPY frontend/package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY frontend/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM python:3.12-slim
|
||||||
|
WORKDIR /app
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
COPY backend/ ./backend/
|
||||||
|
COPY --from=build /app/frontend/dist ./frontend/dist
|
||||||
|
VOLUME ["/app/data"]
|
||||||
|
ENV SETTINGS_PATH=/app/data/settings.json
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SETTINGS_PATH = Path(__file__).parent.parent / "settings.json"
|
SETTINGS_PATH = Path(os.environ.get("SETTINGS_PATH", Path(__file__).parent.parent / "settings.json"))
|
||||||
|
|
||||||
|
|
||||||
def _now():
|
def _now():
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- data:/app/data
|
||||||
|
environment:
|
||||||
|
SETTINGS_PATH: /app/data/settings.json
|
||||||
|
OPENAI_MODEL: gpt-4.1
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
Reference in New Issue
Block a user