Sairesh commited on
Commit
7738270
·
verified ·
1 Parent(s): 1e8719c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -17
Dockerfile CHANGED
@@ -1,27 +1,28 @@
1
  FROM python:3.10-slim
2
 
3
- WORKDIR /app
 
 
 
 
 
4
 
5
- # Install system dependencies for images and networking
 
6
  RUN apt-get update && apt-get install -y \
7
- libglib2.0-0 \
8
- libgl1 \
9
- libsm6 \
10
- libxext6 \
11
- curl \
12
  && rm -rf /var/lib/apt/lists/*
 
13
 
14
- # Copy requirements
15
- COPY requirements.txt .
 
 
16
 
17
- # Force upgrade pip and install requirements
18
- RUN pip install --upgrade pip
19
- RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Copy the rest of the application
22
- COPY . .
23
-
24
- # Expose the Hugging Face port
25
  EXPOSE 7860
26
 
27
- CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Set up user permissions for Hugging Face
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
+ WORKDIR $HOME/app
9
 
10
+ # Install system dependencies (using sudo-less approach)
11
+ USER root
12
  RUN apt-get update && apt-get install -y \
13
+ libglib2.0-0 libgl1 libsm6 libxext6 curl \
 
 
 
 
14
  && rm -rf /var/lib/apt/lists/*
15
+ USER user
16
 
17
+ # Install Python requirements
18
+ COPY --chown=user requirements.txt $HOME/app/
19
+ RUN pip install --no-cache-dir --upgrade pip && \
20
+ pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Copy application files
23
+ COPY --chown=user . $HOME/app
 
24
 
25
+ # Hugging Face looks for port 7860
 
 
 
26
  EXPOSE 7860
27
 
28
+ CMD ["python", "app.py"]