Add Docker support

- Dockerfile: multi-stage Python 3.12 slim build
- docker-compose.yml: app + PostgreSQL 16 with healthcheck
- requirements.txt: fastapi, uvicorn, psycopg, passlib, jose
- .dockerignore: exclude venv, pycache, secrets
- app.py: env-based DB config (DB_HOST/PORT/NAME/USER/PASSWORD)
- README: Docker deploy instructions
This commit is contained in:
Jetour BI
2026-06-18 20:47:23 +00:00
parent 9ff9ec27e9
commit 3f6824d86c
7 changed files with 153 additions and 3 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
# Jetour BI Dashboard — Dockerfile
# Multi-stage: builder for slim runtime
FROM python:3.12-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /root/.local /root/.local
# Copy app code
COPY app.py .
COPY static/ static/
COPY migrations/ migrations/
COPY migrate.py .
# Make sure scripts in .local are in PATH
ENV PATH=/root/.local/bin:$PATH
EXPOSE 8765
# Run migrations then start server
CMD python migrate.py && uvicorn app:app --host 0.0.0.0 --port 8765