Update Dockerfile
Browse files- Dockerfile +10 -9
Dockerfile
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
|
|
| 1 |
# Use a suitable base image with Python installed
|
| 2 |
FROM python:3.9-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 --quiet transformers huggingface_hub bitsandbytes accelerate sentencepiece
|
| 12 |
RUN pip3 install -r requirements.txt
|
| 13 |
|
| 14 |
-
# --- FIX: Set Streamlit to use /tmp for configuration to avoid PermissionError ---
|
| 15 |
-
ENV STREAMLIT_SERVER_PORT=7860 \
|
| 16 |
-
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
|
| 17 |
-
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
| 18 |
-
# This is the crucial fix for the PermissionError:
|
| 19 |
-
STREAMLIT_GLOBAL_DIR="/tmp/streamlit_global"
|
| 20 |
-
|
| 21 |
# Define the command to run the Streamlit app
|
| 22 |
-
CMD ["streamlit", "run", "app.py"]
|
|
|
|
| 1 |
+
# %%writefile deployment_files/Dockerfile
|
| 2 |
# Use a suitable base image with Python installed
|
| 3 |
FROM python:3.9-slim
|
| 4 |
|
| 5 |
# Set the working directory inside the container to /app
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# --- FIX: Set Hugging Face cache location to a writable directory (/tmp) ---
|
| 9 |
+
ENV HF_HOME="/tmp/hf_cache"
|
| 10 |
+
# --- Also setting standard Streamlit ENV variables ---
|
| 11 |
+
ENV STREAMLIT_SERVER_PORT=7860 \
|
| 12 |
+
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
|
| 13 |
+
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
| 14 |
+
STREAMLIT_GLOBAL_DIR="/tmp/streamlit_global"
|
| 15 |
+
|
| 16 |
# Copy all files from the current directory on the host to the container's /app directory
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
# Install Python dependencies listed in requirements.txt
|
|
|
|
| 20 |
RUN pip3 install -r requirements.txt
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Define the command to run the Streamlit app
|
| 23 |
+
CMD ["streamlit", "run", "app.py"]
|