Spaces:
Running
Running
File size: 947 Bytes
82291b8 dd1ea38 94a72a9 82291b8 94a72a9 82291b8 281bf23 82291b8 dd1ea38 82291b8 94a72a9 |
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 |
# Use the official Python 3.10.9 image
FROM python:3.10.9
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into /app inside the container
COPY . /app
# Install dependencies for OpenCV and other requirements
RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 curl
# Create a user to avoid permission issues
RUN useradd -m appuser
# Ensure that saved_images directory is created and has the right permissions
RUN mkdir -p /app/saved_images && chown -R appuser:appuser /app/saved_images
# Switch to the non-root user
USER appuser
# Add /home/appuser/.local/bin to PATH
ENV PATH="/home/appuser/.local/bin:${PATH}"
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Set the FastAPI app environment variable to point to the app file path
ENV PYTHONPATH=/app
# Start the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|