- 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
34 lines
742 B
Docker
34 lines
742 B
Docker
# 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
|