Spaces:
Running
Running
# Base image | |
FROM docker.io/library/python:3.10@sha256:fd0fa50d997eb56ce560c6e5ca6a1f5cf8fdff87572a16ac07fb1f5ca01eb608 | |
# Update pip | |
RUN pip install --no-cache-dir pip==24.2 | |
# Install basic dependencies | |
RUN apt-get update && apt-get install -y \ | |
fakeroot \ | |
git \ | |
git-lfs \ | |
ffmpeg \ | |
libsm6 \ | |
libxext6 \ | |
cmake \ | |
rsync \ | |
libgl1-mesa-glx \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Node.js | |
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | |
apt-get install -y nodejs && \ | |
rm -rf /var/lib/apt/lists/* && apt-get clean | |
# Create a non-root user | |
RUN mv /usr/bin/apt-get /usr/bin/.apt-get && \ | |
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \ | |
chmod +x /usr/bin/apt-get && \ | |
useradd -m -u 1000 user | |
# Set working directory | |
WORKDIR /home/user/app | |
# Copy the requirements file | |
COPY --chown=1000:1000 requirements.txt . | |
# Install torch separately | |
RUN pip install --no-cache-dir torch | |
# Install the remaining packages | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the application code | |
COPY --chown=1000:1000 . . | |
# Set the entry point | |
CMD ["python", "app.py"] |