mahesh1209 commited on
Commit
2e52237
·
verified ·
1 Parent(s): 915c33d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -15
Dockerfile CHANGED
@@ -1,31 +1,31 @@
1
- # Dockerfile for Hugging Face Spaces - ctransformers + Gradio + TinyLlama (GGUF)
2
  FROM python:3.10-slim
3
 
4
- # Install system build tools required by ctransformers and native extensions
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
- build-essential cmake git libclang-dev libssl-dev pkg-config \
8
- && rm -rf /var/lib/apt/lists/*
9
 
10
- # Create non-root user (Spaces runs container with UID 1000 by convention)
11
  RUN useradd -m -u 1000 user
 
 
12
  WORKDIR /app
 
13
 
14
- # Copy requirements and install as root (so system deps are available)
15
- COPY --chown=user:root requirements.txt requirements.txt
16
- RUN python -m pip install --upgrade pip
17
- RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy app
20
- COPY --chown=user:root . /app
21
 
22
  # Switch to non-root user
23
  USER user
24
- ENV HOME=/home/user \
25
- PATH=/home/user/.local/bin:$PATH
26
 
27
- # Expose Gradio default port (Spaces uses app_port in README)
28
  EXPOSE 7860
29
 
30
- # Run the app (the app uses server_name=0.0.0.0 and reads PORT env var)
31
  CMD ["python", "app.py"]
 
1
+ # Dockerfile for Hugging Face Spaces - TinyLlama + ctransformers
2
  FROM python:3.10-slim
3
 
4
+ # Install system packages for ctransformers build
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
+ build-essential cmake git libclang-dev libssl-dev pkg-config && \
8
+ rm -rf /var/lib/apt/lists/*
9
 
10
+ # Create a non-root user (Spaces uses UID 1000)
11
  RUN useradd -m -u 1000 user
12
+
13
+ # Create app directory & make sure non-root user can write
14
  WORKDIR /app
15
+ RUN mkdir -p /home/user/model_cache && chown -R user:user /home/user
16
 
17
+ # Copy requirements and install
18
+ COPY --chown=user:user requirements.txt /app/requirements.txt
19
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
 
20
 
21
+ # Copy app files
22
+ COPY --chown=user:user . /app
23
 
24
  # Switch to non-root user
25
  USER user
 
 
26
 
27
+ # Expose Gradio port
28
  EXPOSE 7860
29
 
30
+ # Run app
31
  CMD ["python", "app.py"]