Update Dockerfile
Browse files- Dockerfile +18 -14
Dockerfile
CHANGED
|
@@ -1,24 +1,28 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
WORKDIR /app
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
RUN mkdir -p /app/.cache /app/.streamlit
|
| 6 |
-
|
| 7 |
-
# 2. Set env‐vars so Transformers & HF hub use /app/.cache
|
| 8 |
-
ENV TRANSFORMERS_CACHE=/app/.cache \
|
| 9 |
-
HF_HOME=/app/.cache \
|
| 10 |
-
XDG_CACHE_HOME=/app/.cache \
|
| 11 |
-
STREAMLIT_CONFIG_DIR=/app/.streamlit
|
| 12 |
-
|
| 13 |
-
# 3. Install dependencies
|
| 14 |
COPY requirements.txt /app/requirements.txt
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
-
#
|
| 18 |
COPY src/ /app/src/
|
| 19 |
|
| 20 |
-
#
|
| 21 |
EXPOSE 8501
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
WORKDIR /app
|
| 3 |
|
| 4 |
+
# Copy and install your Python deps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
COPY requirements.txt /app/requirements.txt
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
|
| 8 |
+
# Copy in your Streamlit source
|
| 9 |
COPY src/ /app/src/
|
| 10 |
|
| 11 |
+
# Expose the port Streamlit will run on
|
| 12 |
EXPOSE 8501
|
| 13 |
|
| 14 |
+
# 1️⃣ Create writable cache/config under /tmp
|
| 15 |
+
RUN mkdir -p /tmp/.cache/transformers \
|
| 16 |
+
/tmp/.cache/huggingface \
|
| 17 |
+
/tmp/.cache/xdg \
|
| 18 |
+
/tmp/.streamlit
|
| 19 |
+
|
| 20 |
+
# 2️⃣ Point all caches and Streamlit config into /tmp
|
| 21 |
+
ENV TRANSFORMERS_CACHE=/tmp/.cache/transformers \
|
| 22 |
+
HF_HOME=/tmp/.cache/huggingface \
|
| 23 |
+
XDG_CACHE_HOME=/tmp/.cache/xdg \
|
| 24 |
+
STREAMLIT_CONFIG_DIR=/tmp/.streamlit
|
| 25 |
+
|
| 26 |
+
# 3️⃣ Launch your app
|
| 27 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \
|
| 28 |
+
"--server.port=8501", "--server.address=0.0.0.0"]
|