r3hab commited on
Commit
0e421ec
·
verified ·
1 Parent(s): ee6bea1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -8
Dockerfile CHANGED
@@ -1,16 +1,33 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
 
5
 
 
 
 
 
 
 
 
 
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
-
10
  WORKDIR /app
11
 
12
- COPY --chown=user ./requirements.txt requirements.txt
13
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
 
 
 
 
14
 
15
- COPY --chown=user . /app
16
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Start with Python base image
2
+ FROM python:3.9-slim
3
 
4
+ # Install system dependencies as root
5
+ USER root
6
 
7
+ # Install required system packages
8
+ RUN apt-get update && apt-get install -y \
9
+ libtorrent-rasterbar-dev \
10
+ build-essential \
11
+ libssl-dev \
12
+ libboost-system-dev \
13
+ libmagic1 \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Create non-root user
17
  RUN useradd -m -u 1000 user
18
  USER user
19
  ENV PATH="/home/user/.local/bin:$PATH"
 
20
  WORKDIR /app
21
 
22
+ # Install Python dependencies
23
+ COPY --chown=user requirements.txt .
24
+ RUN pip install --no-cache-dir --user --upgrade -r requirements.txt
25
+
26
+ # Copy application files
27
+ COPY --chown=user . .
28
+
29
+ # Expose Hugging Face default port
30
+ EXPOSE 7860
31
 
32
+ # Start the application
33
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]