text-to-video / Dockerfile
Ankit8544's picture
Update Dockerfile
b740d6a verified
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
# Set timezone non-interactively
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
ffmpeg \
libgl1 \
git \
&& rm -rf /var/lib/apt/lists/*
# Set Python alias
RUN ln -s /usr/bin/python3.10 /usr/bin/python
# Create a non-root user and set proper permissions for /app and its subdirectories
RUN useradd -m myuser && \
mkdir -p /app /app/.modelscope && \
chown -R myuser:myuser /app /app/.modelscope
# Switch to the non-root user
USER myuser
# Create working directory
WORKDIR /app
# Copy all files to container
COPY . .
# Set a writable cache directory for ModelScope
ENV MODELSCOPE_CACHE=/app/.modelscope
# Create the cache directory with proper permissions
RUN mkdir -p /app/.modelscope && chmod -R 777 /app/.modelscope
# Install Python dependencies
RUN pip install \
flask \
torch \
torchvision \
diffusers \
imageio \
modelscope==1.25.0 \
accelerate \
addict \
datasets==2.18.0
# Expose port
EXPOSE 7860
# Run your Flask app
CMD ["python", "app.py"]