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:
33
Dockerfile
Normal file
33
Dockerfile
Normal 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
|
||||
Reference in New Issue
Block a user