carpet-analysis-api / Dockerfile
v
Update Dockerfile
d2718ef verified
Raw History Blame Contribute Delete
814 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 \
libgl1 \
libglib2.0-0 \
&& 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 app.py .
COPY database_postgres.py .
# Copy model files
COPY cnn_a_model.onnx .
COPY cnn_b_model.onnx .
COPY unet_model.onnx .
COPY sam2_hiera_base_plus.pt .
# Expose port (Hugging Face Spaces uses 7860 by default)
EXPOSE 7860
# Set environment variable for Hugging Face Spaces
ENV UVICORN_PORT=7860
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]