crowdcontrol / Dockerfile
promptsai's picture
Update Dockerfile
7704533 verified
raw
history blame
986 Bytes
# Base image
FROM python:3.9
# Set the working directory in the container
WORKDIR /code
# Set environment variables for writable directories
ENV MPLCONFIGDIR=/tmp/matplotlib_cache
ENV XDG_CACHE_HOME=/tmp/cache
ENV TORCH_HOME=/tmp/cache/torch
# Create necessary directories and set permissions
RUN mkdir -p /.cache/gdown /code/pretrained_models /tmp/cache/torch \
&& chmod -R 777 /.cache /code/pretrained_models /tmp/cache
# Install libGL for OpenCV
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx
# Copy the requirements file into the container at /code
COPY code/requirements.txt /code/
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Install additional packages
RUN pip install uvicorn torch torchvision numpy>=1.16.5 scipy>=1.3.0 opencv-python gdown Pillow gradio
# Copy the rest of your application's code
COPY . .
# Command to run the application
CMD ["python", "code/demo.py"]