Update Dockerfile
Browse files- Dockerfile +9 -15
Dockerfile
CHANGED
|
@@ -1,27 +1,21 @@
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
| 3 |
-
# 1.
|
| 4 |
-
|
| 5 |
|
| 6 |
-
# 2.
|
| 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 |
-
#
|
| 17 |
ENV HOME=/home/user
|
| 18 |
-
ENV PATH=/home/user/.local/bin:$PATH
|
| 19 |
|
| 20 |
-
#
|
| 21 |
WORKDIR $HOME/app
|
| 22 |
|
| 23 |
-
#
|
| 24 |
COPY --chown=user:user . $HOME/app
|
| 25 |
|
| 26 |
-
#
|
| 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"]
|