gtech13 commited on
Commit
681730a
·
verified ·
1 Parent(s): 946ab5d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -15
Dockerfile CHANGED
@@ -1,27 +1,21 @@
1
  FROM python:3.10
2
 
3
- # 1. Set a temporary working directory
4
- WORKDIR /code
5
 
6
- # 2. Copy just the requirements first and install them GLOBALLY
7
- COPY ./requirements.txt /code/requirements.txt
8
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
9
-
10
- # 3. Create the restricted user required by Hugging Face Spaces
11
  RUN useradd -m -u 1000 user
12
-
13
- # 4. Switch to that user
14
  USER user
15
 
16
- # 5. Set up the user's safe environment variables
17
  ENV HOME=/home/user
18
- ENV PATH=/home/user/.local/bin:$PATH
19
 
20
- # 6. Set the working directory to the user's safe space
21
  WORKDIR $HOME/app
22
 
23
- # 7. Copy your app.py and images into the container, owned by the safe user
24
  COPY --chown=user:user . $HOME/app
25
 
26
- # 8. Launch Streamlit safely
27
- CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
 
1
  FROM python:3.10
2
 
3
+ # 1. HARDCODE THE INSTALLATION (Bypasses requirements.txt completely)
4
+ RUN pip install --no-cache-dir streamlit pandas bertopic sentence-transformers scikit-learn umap-learn hdbscan gensim matplotlib seaborn
5
 
6
+ # 2. Create the Hugging Face restricted user
 
 
 
 
7
  RUN useradd -m -u 1000 user
 
 
8
  USER user
9
 
10
+ # 3. Set the environment variables safely
11
  ENV HOME=/home/user
12
+ ENV PATH=/usr/local/bin:/home/user/.local/bin:$PATH
13
 
14
+ # 4. Set the working directory
15
  WORKDIR $HOME/app
16
 
17
+ # 5. Copy your python code and images into the container
18
  COPY --chown=user:user . $HOME/app
19
 
20
+ # 6. Launch explicitly through Python to bypass the Linux PATH entirely
21
+ CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]