File size: 1,061 Bytes
f82d1ce 56ae4b6 94a71bc f82d1ce 94a71bc f82d1ce 56ae4b6 94a71bc f82d1ce f19edcf f82d1ce 94a71bc f82d1ce 94a71bc f82d1ce 94a71bc f82d1ce 56ae4b6 8155a56 f82d1ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies required for OpenCV
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements.txt into the container at /app
COPY requirements.txt /app/
# Install any needed Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create writable directories for caching and configuration
RUN mkdir -p /app/cache /app/config && chmod -R 777 /app/cache /app/config
# Set environment variables
ENV HF_HOME=/app/cache \
MPLCONFIGDIR=/app/config/matplotlib \
YOLO_CONFIG_DIR=/app/config/ultralytics
ENV HUGGINGFACE_HUB_ENABLE_HF_UPGRADE_CHECK=false
# Copy the current directory contents into the container at /app
COPY . /app/
# Expose port 8000 for the FastAPI app
EXPOSE 8000
# Run FastAPI app using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] |