karthikrathod commited on
Commit
ee19447
1 Parent(s): 197ce2c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -8
Dockerfile CHANGED
@@ -1,17 +1,23 @@
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
- WORKDIR /code
 
 
7
 
8
- COPY ./requirements.txt /code/requirements.txt
 
9
 
 
 
10
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
 
 
12
  RUN mkdir -p /storage
13
- RUN chmod 777 /storage
14
 
15
- COPY . .
 
16
 
17
- CMD ["streamlit", "run", "streamlit_app.py", "--server.port", "7860"]
 
 
1
+ # Base image
 
 
2
  FROM python:3.9
3
 
4
+ # Set a non-root user
5
+ RUN useradd -m appuser
6
+ USER appuser
7
 
8
+ # Set working directory
9
+ WORKDIR /code
10
 
11
+ # Copy requirements file and install dependencies
12
+ COPY --chown=appuser ./requirements.txt /code/requirements.txt
13
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
14
 
15
+ # Create storage directory with proper permissions
16
  RUN mkdir -p /storage
17
+ RUN chown appuser:appuser /storage
18
 
19
+ # Copy application code
20
+ COPY --chown=appuser . /code
21
 
22
+ # Set the command to run the app
23
+ CMD ["streamlit", "run", "streamlit_app.py", "--server.port", "7860"]