nilotpaldhar2004 commited on
Commit
deb9e1f
·
verified ·
1 Parent(s): 4a0c990

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,10 +1,13 @@
1
  FROM python:3.11-slim
2
 
3
- # 1. Setup root-level tasks (Install compiler and create user)
4
- RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
5
- RUN useradd -m -u 1000 user
 
 
6
 
7
- # 2. Environment Variables
 
8
  ENV HOME=/home/user \
9
  PATH=/home/user/.local/bin:$PATH \
10
  PYTHONUNBUFFERED=1 \
@@ -13,17 +16,17 @@ ENV HOME=/home/user \
13
 
14
  WORKDIR $HOME/app
15
 
16
- # 3. Create cache directories with correct permissions
17
  RUN mkdir -p $HF_HOME && chown -R user:user $HOME
18
 
19
  USER user
20
 
21
- # 4. Install dependencies (Cache Layer)
22
  COPY --chown=user requirements.txt .
23
  RUN pip install --no-cache-dir --upgrade pip && \
24
  pip install --no-cache-dir -r requirements.txt
25
 
26
- # 5. Copy application code
27
  COPY --chown=user . .
28
 
29
  EXPOSE 7860
 
1
  FROM python:3.11-slim
2
 
3
+ # Install system dependencies for sentencepiece and other C++ builds
4
+ USER root
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ && rm -rf /var/lib/apt/lists/*
8
 
9
+ # Setup user
10
+ RUN useradd -m -u 1000 user
11
  ENV HOME=/home/user \
12
  PATH=/home/user/.local/bin:$PATH \
13
  PYTHONUNBUFFERED=1 \
 
16
 
17
  WORKDIR $HOME/app
18
 
19
+ # Ensure cache directory exists
20
  RUN mkdir -p $HF_HOME && chown -R user:user $HOME
21
 
22
  USER user
23
 
24
+ # Install Python requirements
25
  COPY --chown=user requirements.txt .
26
  RUN pip install --no-cache-dir --upgrade pip && \
27
  pip install --no-cache-dir -r requirements.txt
28
 
29
+ # Copy application
30
  COPY --chown=user . .
31
 
32
  EXPOSE 7860