rasmodev commited on
Commit
a830411
·
verified ·
1 Parent(s): 4807e3b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ build-essential \
5
+ curl \
6
+ libgl1 \
7
+ libglib2.0-0 \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ RUN useradd -m -u 1000 appuser
11
+
12
+ WORKDIR /app
13
+
14
+ COPY requirements.txt .
15
+
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir \
18
+ torch==2.2.2+cpu \
19
+ torchvision==0.17.2+cpu \
20
+ --extra-index-url https://download.pytorch.org/whl/cpu && \
21
+ pip install --no-cache-dir -r requirements.txt
22
+
23
+ COPY . .
24
+
25
+ RUN mkdir -p /app/.streamlit && printf '[server]\nmaxUploadSize = 200\nenableCORS = false\nenableXsrfProtection = false\nport = 7860\n\n[browser]\ngatherUsageStats = false\n' > /app/.streamlit/config.toml
26
+
27
+ RUN chown -R appuser:appuser /app
28
+ USER appuser
29
+
30
+ ENV HF_HOME=/app/.cache/huggingface
31
+ ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
32
+
33
+ EXPOSE 7860
34
+
35
+ CMD ["streamlit", "run", "app.py", \
36
+ "--server.port=7860", \
37
+ "--server.address=0.0.0.0", \
38
+ "--server.headless=true", \
39
+ "--server.maxUploadSize=200", \
40
+ "--server.enableCORS=false", \
41
+ "--server.enableXsrfProtection=false", \
42
+ "--browser.gatherUsageStats=false"]