Guidelines for multi-stage Docker builds, asset inlining, and Nginx SSE configuration.
This skill captures the specific configurations and strategies required to reliably deploy DocxAI, especially focusing on the ChatGPT integration challenges.
Use a multi-stage approach to separate the React build environment from the Python runtime.
Pattern:
# Stage 1: Build Frontend
FROM node:18-alpine AS builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Production
FROM python:3.10-slim
COPY --from=builder /app/frontend/dist /app/frontend/dist
# ... copy backend and run ...
To support Server-Sent Events (SSE), Nginx must be configured to bypass buffering.
Mandatory Config:
proxy_buffering off: Prevents Nginx from holding chunks.proxy_set_header Connection '': Required for HTTP/1.1 streaming.proxy_read_timeout 86400s: Prevents the tunnel from closing during long AI responses.For the ChatGPT panel to work, the frontend should be a single index.html.
python3 inline_assets.py after the frontend build.linux/amd64.--admin-enabled true for App Service to pull images.WEBSITES_PORT=80 in App Service settings to direct traffic to Nginx.dist folder was copied correctly in Dockerfile.nginx.conf for proxy_buffering off.linux/amd64.