Spaces:
Sleeping
Sleeping
File size: 1,265 Bytes
5900a5b 570f7bd 5900a5b b432020 cdd9515 5900a5b cdd9515 5900a5b 9077a1f 5900a5b aa4ed26 b432020 00ff3b7 9231424 5900a5b 4287d48 00ff3b7 5900a5b 00ff3b7 5900a5b cdd9515 5900a5b cdbc665 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# -------------------------------------
# Base image (runtime)
# -------------------------------------
FROM python:3.12-slim AS base
# Prevent Python from writing .pyc files and force stdout flush
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860
# Install tini (proper init process) + curl (for healthcheck)
RUN apt-get update && apt-get install -y --no-install-recommends tini curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# -------------------------------------
# Builder stage (dependencies)
# -------------------------------------
FROM base AS builder
WORKDIR /app
COPY requirements.txt .
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gcc \
&& pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& rm -rf /var/lib/apt/lists/*
# -------------------------------------
# Builder stage (dependencies)
# -------------------------------------
FROM base AS final
WORKDIR /app
# Copy installed dependencies from builder
COPY --from=builder /usr/local /usr/local
COPY . .
# Expose ports (FastAPI + Gradio)
EXPOSE 7860
EXPOSE 8000
# tini handles PID1, zombie reaping, and signals
ENTRYPOINT ["tini", "--"]
CMD ["python", "-u", "start.py"]
|