Spaces:
Running
Running
File size: 832 Bytes
3117eff ddec2fd | 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 | FROM python:3.10-slim-bullseye
# Set working directory
WORKDIR /app
# Install system dependencies first (including curl)
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set environment variables
ENV HF_HOME=/tmp/cache
ENV PORT=7860
# Create cache directory (if still needed)
RUN mkdir -p ${HF_HOME} && chmod 777 ${HF_HOME}
# Expose port
EXPOSE $PORT
# Command to run the FastAPI app
CMD bash -c "while true; do curl -s https://xce009-inference-test.hf.space/ping >/dev/null && sleep 300 || sleep 300; done & uvicorn model_service_api:app --host 0.0.0.0 --port $PORT" |