prj1 / Dockerfile
iitmbs24f's picture
Upload 16 files
9b572f2 verified
raw
history blame contribute delete
920 Bytes
# Use Python 3.11 slim image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create non-root user
RUN useradd --create-home --shell /bin/bash app \
&& chown -R app:app /app
USER app
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Health check for Hugging Face Spaces
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/ready')"
# Make startup script executable
RUN chmod +x start.sh
# Start command for Hugging Face Spaces
CMD ["./start.sh"]