Growth / Dockerfile
MissingBreath's picture
Update Dockerfile
6755895 verified
FROM python:3.12
WORKDIR /code
# Set environment variables
ENV HF_HOME=/code/.cache/
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
wget \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better layer caching
COPY ./requirements.txt /code/requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /code/requirements.txt
# Download model files
RUN gdown 1rNuPqBymyU_C257g9gy7rBZuzZ_JLjB5 && \
gdown 1vL2JusohMBI1IgNlS7pgiY2felggEsvXgGHlKINs3ic && \
gdown 1kQ9N7oWpMJuJ1_QeilrWq6pbXR0b0gZh && \
gdown 1yjUremWtmGr8G2y99jeK9iSq9a4ytHIi && \
gdown 1sg_HXv0HoEYYczWOEV9VrutBmib-jk1Y && \
gdown 1-5MBTIn5aCfoFzraIPKZ_RcOD4i67mY4 && \
gdown 1UAyr6fD8UubpSqMqrU2s_1ukWLBbZVZl && \
wget https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m.pt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /code/Chroma/ && chmod 777 /code/Chroma/
# Run as root (required for Hugging Face Spaces)
USER root
# Expose port
EXPOSE 7860
# Start the application
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]