aryachakraborty commited on
Commit
b27f0a4
·
verified ·
1 Parent(s): 30d0cc7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -16
Dockerfile CHANGED
@@ -1,16 +1,25 @@
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 ["gunicorn","-b","0.0.0.0:7860", "app:app"]
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Create user
4
+ RUN useradd -m -u 1000 user
5
+
6
+ # Set environment for pip
7
+ ENV PATH="/home/user/.local/bin:$PATH" \
8
+ PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1 \
10
+ TRANSFORMERS_NO_ADVISORY_WARNINGS=1 \
11
+ HF_HUB_DISABLE_SYMLINKS_WARNING=1
12
+
13
+ USER user
14
+ WORKDIR /app
15
+
16
+ # Install dependencies
17
+ COPY --chown=user ./requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir --upgrade pip \
19
+ && pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Copy source
22
+ COPY --chown=user . /app
23
+
24
+ # Start with thread worker, increased timeout
25
+ CMD ["gunicorn", "-w", "1", "-k", "gthread", "-t", "300", "-b", "0.0.0.0:7860", "app:app"]