jayman commited on
Commit
feb02ea
·
verified ·
1 Parent(s): 27fd103

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+
3
+ # Prevent interactive prompts during apt installation
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Install Python 3.12, pip, git, and required system libraries (including the newer libstdc++6)
7
+ RUN apt-get update && apt-get install -y \
8
+ python3.12 \
9
+ python3.12-venv \
10
+ python3-pip \
11
+ git \
12
+ wget \
13
+ libgl1-mesa-glx \
14
+ libglib2.0-0 \
15
+ libstdc++6 \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Create a non-root user (required by Hugging Face Spaces)
19
+ RUN useradd -m -u 1000 user
20
+ USER user
21
+ ENV HOME=/home/user \
22
+ PATH=/home/user/venv/bin:$PATH
23
+
24
+ WORKDIR $HOME/app
25
+
26
+ # Create a virtual environment
27
+ RUN python3.12 -m venv $HOME/venv
28
+
29
+ # Copy requirements and install them
30
+ COPY --chown=user requirements.txt .
31
+ RUN pip install --no-cache-dir --upgrade pip && \
32
+ pip install --no-cache-dir -r requirements.txt
33
+
34
+ # Copy the rest of the application files
35
+ COPY --chown=user . .
36
+
37
+ # Expose the Gradio port
38
+ EXPOSE 7860
39
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
40
+ ENV GRADIO_SERVER_PORT="7860"
41
+
42
+ # Run the application
43
+ CMD ["python", "app.py"]