sql-repair-env / Dockerfile
ashoka0402
clean commit (removed token)
64ccc23
Raw History Blame Contribute Delete
1.53 kB
# ── Stage 1: builder ──────────────────────────────────────────────────────
FROM python:3.11-slim AS builder
WORKDIR /build
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies into a prefix
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ── Stage 2: runtime ──────────────────────────────────────────────────────
FROM python:3.11-slim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application code
COPY app/ ./app/
COPY server/ ./server/
COPY data/ ./data/
COPY db/ ./db/
COPY inference.py .
COPY openenv.yaml .
# Validate that the app imports cleanly at build time
COPY validate.py .
RUN python validate.py
# Expose server port
EXPOSE 7860
# Health check β€” ping /health every 30s, allow 10s startup
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')"
# Run the FastAPI server
CMD ["python", "-m", "uvicorn", "server.app:app", \
"--host", "0.0.0.0", "--port", "7860", \
"--workers", "1", "--log-level", "info"]