ChatAPI / Dockerfile
Soumik555's picture
chat-api-added requirements.txt
c4a8c0c
raw
history blame contribute delete
816 Bytes
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-chatapi.hf.space/ping >/dev/null && sleep 300 || sleep 300; done & uvicorn chat_api:app --host 0.0.0.0 --port $PORT"