blueprint-detector / Dockerfile
ayushmorbar's picture
Update Dockerfile to use uvicorn correctly
ba0b7ee verified
raw
history blame contribute delete
804 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
FROM python:3.9-slim
RUN useradd -m -u 1000 user
# Install required packages
USER root
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements and install Python packages
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy model files and application code
COPY --chown=user ./models/best.pt /app/models/
COPY --chown=user ./classes.txt /app/
COPY --chown=user ./app.py /app/
# Set up the correct port for Hugging Face
ENV PORT=7860
# Run the application with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]