sikeaditya commited on
Commit
87e99c6
·
verified ·
1 Parent(s): b85268b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -11
Dockerfile CHANGED
@@ -1,18 +1,21 @@
1
- # Use an official lightweight Python image
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Copy the requirements file and install dependencies
8
- COPY requirements.txt .
9
- RUN pip install --upgrade pip && pip install -r requirements.txt
10
 
11
- # Copy the rest of your app's code
12
- COPY . .
 
 
 
13
 
14
- # Expose the default Streamlit port
15
- EXPOSE 8501
 
16
 
17
- # Run the Streamlit app with adjusted security settings to disable both CORS and XSRF protection
18
- CMD ["streamlit", "run", "app.py", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.port=8501"]
 
 
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Copy and install requirements
6
+ COPY requirements.txt /app/requirements.txt
7
+ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
8
 
9
+ # Set up a new non-root user
10
+ RUN useradd -m -u 1000 user
11
+ USER user
12
+ ENV HOME=/home/user
13
+ ENV PATH=/home/user/.local/bin:$PATH
14
 
15
+ # Create a cache directory and set environment variable
16
+ RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache
17
+ ENV HF_HOME=/home/user/.cache
18
 
19
+ # Set working directory to the user's app directory
20
+ WORKDIR $HOME/app
21
+ COPY --chown=user . $HOME/app