muddasser commited on
Commit
46e86fa
·
verified ·
1 Parent(s): e940617

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
  FROM python:3.11-slim
2
 
3
- # libgomp1 is needed by faiss-cpu on slim images
4
  RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
5
  && rm -rf /var/lib/apt/lists/*
6
 
7
- WORKDIR /app
8
-
9
- COPY requirements.txt .
10
- RUN pip install --no-cache-dir -r requirements.txt
11
-
12
- COPY app.py .
13
-
14
- ENV HF_HOME=/tmp/hf \
15
  STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
 
16
 
17
- EXPOSE 7860
 
 
 
18
 
19
- # XSRF/CORS are disabled because file uploads fail inside the Hugging Face Spaces iframe otherwise
20
  CMD ["streamlit", "run", "app.py", \
21
  "--server.port=7860", \
22
  "--server.address=0.0.0.0", \
 
1
  FROM python:3.11-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
4
  && rm -rf /var/lib/apt/lists/*
5
 
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH \
10
+ HF_HOME=/tmp/hf \
 
 
 
11
  STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
12
+ WORKDIR $HOME/app
13
 
14
+ RUN pip install --no-cache-dir --user torch --index-url https://download.pytorch.org/whl/cpu
15
+ COPY --chown=user requirements.txt .
16
+ RUN pip install --no-cache-dir --user -r requirements.txt
17
+ COPY --chown=user app.py .
18
 
19
+ EXPOSE 7860
20
  CMD ["streamlit", "run", "app.py", \
21
  "--server.port=7860", \
22
  "--server.address=0.0.0.0", \