richard-su commited on
Commit
6640fdd
·
verified ·
1 Parent(s): 17dac9a

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +70 -0
Dockerfile ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.10.12 as base image
2
+ FROM python:3.10.12-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONUNBUFFERED=1 \
6
+ PYTHONDONTWRITEBYTECODE=1 \
7
+ PORT=7860 \
8
+ DEPLOYMENT_MODE=local \
9
+ HF_SPACES_MODE=1
10
+
11
+ # Create user for HF Spaces compatibility
12
+ RUN useradd -m -u 1000 user
13
+
14
+ # Set working directory
15
+ WORKDIR /app
16
+
17
+ # Update package list and install system dependencies from packages.txt
18
+ RUN apt-get update && apt-get install -y --no-install-recommends \
19
+ ffmpeg \
20
+ git \
21
+ wget \
22
+ curl \
23
+ unzip \
24
+ gnupg2 \
25
+ apt-transport-https \
26
+ ca-certificates \
27
+ lsb-release \
28
+ libglib2.0-0 \
29
+ libnss3 \
30
+ libatk-bridge2.0-0 \
31
+ libdrm2 \
32
+ libxkbcommon0 \
33
+ libxcomposite1 \
34
+ libxdamage1 \
35
+ libxrandr2 \
36
+ libgbm1 \
37
+ libxss1 \
38
+ libasound2 \
39
+ libgtk-3-0 \
40
+ libx11-xcb1 \
41
+ libxcb-dri3-0 \
42
+ libgconf-2-4 \
43
+ chromium-driver \
44
+ && apt-get clean \
45
+ && rm -rf /var/lib/apt/lists/*
46
+
47
+ # Copy requirements and install Python dependencies
48
+ COPY --chown=user requirements.txt /app/requirements.txt
49
+ RUN pip install --no-cache-dir --upgrade pip && \
50
+ pip install --no-cache-dir -r requirements.txt
51
+
52
+ # Copy source code
53
+ COPY --chown=user . /app
54
+
55
+ # Switch to user
56
+ USER user
57
+
58
+ # Set user environment
59
+ ENV HOME=/home/user \
60
+ PATH=/home/user/.local/bin:$PATH \
61
+ PYTHONPATH=/app
62
+
63
+ # Create cache directory
64
+ RUN mkdir -p /home/user/.cache
65
+
66
+ # Expose port
67
+ EXPOSE 7860
68
+
69
+ # Start the application
70
+ CMD ["python", "app.py"]