jmanhype commited on
Commit
58dbfa2
·
1 Parent(s): 79a7db2

fix: simplify and correct Dockerfile.spaces

Browse files
Files changed (1) hide show
  1. Dockerfile.spaces +49 -0
Dockerfile.spaces CHANGED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ # Add retry logic for apt-get
6
+ RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
7
+
8
+ # Clean and update package lists
9
+ RUN rm -rf /var/lib/apt/lists/* && \
10
+ apt-get clean && \
11
+ apt-get update --fix-missing
12
+
13
+ # Install system dependencies with retry logic
14
+ RUN apt-get install -y --no-install-recommends --fix-missing \
15
+ git \
16
+ python3-pip \
17
+ python3-dev \
18
+ ffmpeg \
19
+ libsm6 \
20
+ libxext6 \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Set up a new user named "user" with user ID 1000
24
+ RUN useradd -m -u 1000 user
25
+ USER user
26
+
27
+ # Set home to the user's home directory
28
+ ENV HOME=/home/user \
29
+ PATH=/home/user/.local/bin:$PATH
30
+
31
+ # Set the working directory
32
+ WORKDIR $HOME/app
33
+
34
+ # Install dependencies
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ # Copy the application code
38
+ COPY --chown=user . .
39
+
40
+ # Create data directory with correct permissions
41
+ USER root
42
+ RUN mkdir -p /data && chown -R user:user /data
43
+ USER user
44
+
45
+ # Expose the port
46
+ EXPOSE 7860
47
+
48
+ # Start the Gradio app
49
+ CMD ["python", "app.py"]