Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +48 -0
Dockerfile
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Base image
|
2 |
+
FROM docker.io/library/python:3.10@sha256:fd0fa50d997eb56ce560c6e5ca6a1f5cf8fdff87572a16ac07fb1f5ca01eb608
|
3 |
+
|
4 |
+
# Update pip
|
5 |
+
RUN pip install --no-cache-dir pip==24.2
|
6 |
+
|
7 |
+
# Install basic dependencies
|
8 |
+
RUN apt-get update && apt-get install -y \
|
9 |
+
fakeroot \
|
10 |
+
git \
|
11 |
+
git-lfs \
|
12 |
+
ffmpeg \
|
13 |
+
libsm6 \
|
14 |
+
libxext6 \
|
15 |
+
cmake \
|
16 |
+
rsync \
|
17 |
+
libgl1-mesa-glx \
|
18 |
+
curl \
|
19 |
+
&& rm -rf /var/lib/apt/lists/*
|
20 |
+
|
21 |
+
# Install Node.js
|
22 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
23 |
+
apt-get install -y nodejs && \
|
24 |
+
rm -rf /var/lib/apt/lists/* && apt-get clean
|
25 |
+
|
26 |
+
# Create a non-root user
|
27 |
+
RUN mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
28 |
+
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
|
29 |
+
chmod +x /usr/bin/apt-get && \
|
30 |
+
useradd -m -u 1000 user
|
31 |
+
|
32 |
+
# Set working directory
|
33 |
+
WORKDIR /home/user/app
|
34 |
+
|
35 |
+
# Copy the requirements file
|
36 |
+
COPY --chown=1000:1000 requirements.txt .
|
37 |
+
|
38 |
+
# Install torch separately
|
39 |
+
RUN pip install --no-cache-dir torch
|
40 |
+
|
41 |
+
# Install the remaining packages
|
42 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
43 |
+
|
44 |
+
# Copy the application code
|
45 |
+
COPY --chown=1000:1000 . .
|
46 |
+
|
47 |
+
# Set the entry point
|
48 |
+
CMD ["python", "app.py"]
|