Inventory_Detect / Dockerfile
VishnuCodes's picture
Update Dockerfile
59ade7c verified
# Base image with Python 3.9
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV TORCH_HOME=/app/.cache
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Create necessary directories and set permissions
RUN mkdir -p /app/.cache && chmod -R 777 /app
# Copy requirements.txt into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Downgrade NumPy for compatibility
RUN pip install "numpy<2.0"
# Copy the application code
COPY . .
# Set permissions for all files and directories in /app
RUN chmod -R 777 /app
# Expose the port for the FastAPI application
EXPOSE 7860
# Command to run the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]