spac1ngcat commited on
Commit
3ab6422
·
verified ·
1 Parent(s): 1dc86ef

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -8
Dockerfile CHANGED
@@ -1,18 +1,21 @@
1
- # Use a minimal base image with Python 3.9 installed
2
  FROM python:3.11-slim
3
 
4
- # Set the working directory inside the container to /app
5
- WORKDIR /app
 
 
 
6
 
7
- # Copy all files from the current directory on the host to the container's /app directory
8
- COPY . .
 
9
 
10
- # Install Python dependencies listed in requirements.txt
11
- RUN pip3 install -r requirements.txt
12
 
13
  EXPOSE 8501
14
 
15
- # Define the command to run the Streamlit app on port 8501 and make it accessible externally
16
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
17
 
18
  # NOTE: Disable XSRF protection for easier external access in order to make batch predictions
 
1
+
2
  FROM python:3.11-slim
3
 
4
+ # Create non-root user that matches Spaces runtime (uid 1000), set HOME
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
8
+ WORKDIR $HOME/app
9
 
10
+ # Install dependencies as the user
11
+ COPY --chown=user requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy app code with correct ownership
15
+ COPY --chown=user . .
16
 
17
  EXPOSE 8501
18
 
 
19
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
20
 
21
  # NOTE: Disable XSRF protection for easier external access in order to make batch predictions