Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -8
Dockerfile
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
chromium \
|
|
@@ -24,15 +27,15 @@ RUN apt-get update && apt-get install -y \
|
|
| 24 |
# Set working directory
|
| 25 |
WORKDIR /app
|
| 26 |
|
| 27 |
-
# Create cache directories with proper permissions
|
| 28 |
-
RUN mkdir -p /app/cache/pip /tmp/.wdm
|
| 29 |
-
chmod -R 777 /app/cache /
|
| 30 |
-
rm -rf /tmp/* # Clear /tmp at build time
|
| 31 |
|
| 32 |
-
# Set pip cache directory
|
| 33 |
ENV XDG_CACHE_HOME=/app/cache/pip
|
| 34 |
# Disable pip cache to avoid permission issues
|
| 35 |
ENV PIP_NO_CACHE_DIR=1
|
|
|
|
| 36 |
|
| 37 |
# Copy requirements first to leverage Docker cache
|
| 38 |
COPY requirements.txt .
|
|
@@ -59,13 +62,13 @@ ENV DISPLAY=:99
|
|
| 59 |
ENV PYTHONUNBUFFERED=1
|
| 60 |
ENV STREAMLIT_OPT_OUT_OF_USAGE_STATISTICS=true
|
| 61 |
ENV HF_HOME=/app/cache
|
| 62 |
-
ENV WDM_CACHE_DIR=/tmp/.wdm
|
| 63 |
|
| 64 |
# Ensure ChromeDriver and Chromium are executable
|
| 65 |
RUN chmod +x /usr/bin/chromedriver /usr/bin/chromium
|
| 66 |
|
| 67 |
-
# Clear /tmp at container startup
|
| 68 |
-
CMD ["sh", "-c", "rm -rf /tmp/* &&
|
| 69 |
|
| 70 |
# Expose Streamlit port
|
| 71 |
EXPOSE 8501
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Run as root to avoid permission issues
|
| 4 |
+
USER root
|
| 5 |
+
|
| 6 |
# Install system dependencies
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
chromium \
|
|
|
|
| 27 |
# Set working directory
|
| 28 |
WORKDIR /app
|
| 29 |
|
| 30 |
+
# Create cache and tmp directories with proper permissions
|
| 31 |
+
RUN mkdir -p /app/cache/pip /app/tmp/.wdm && \
|
| 32 |
+
chmod -R 777 /app/cache /app/tmp
|
|
|
|
| 33 |
|
| 34 |
+
# Set pip cache and tmp directory
|
| 35 |
ENV XDG_CACHE_HOME=/app/cache/pip
|
| 36 |
# Disable pip cache to avoid permission issues
|
| 37 |
ENV PIP_NO_CACHE_DIR=1
|
| 38 |
+
ENV TMPDIR=/app/tmp
|
| 39 |
|
| 40 |
# Copy requirements first to leverage Docker cache
|
| 41 |
COPY requirements.txt .
|
|
|
|
| 62 |
ENV PYTHONUNBUFFERED=1
|
| 63 |
ENV STREAMLIT_OPT_OUT_OF_USAGE_STATISTICS=true
|
| 64 |
ENV HF_HOME=/app/cache
|
| 65 |
+
ENV WDM_CACHE_DIR=/app/tmp/.wdm
|
| 66 |
|
| 67 |
# Ensure ChromeDriver and Chromium are executable
|
| 68 |
RUN chmod +x /usr/bin/chromedriver /usr/bin/chromium
|
| 69 |
|
| 70 |
+
# Clear /app/tmp at container startup
|
| 71 |
+
CMD ["sh", "-c", "rm -rf /app/tmp/* && streamlit run app.py --server.port=8501 --server.address=0.0.0.0 --server.fileWatcherType=none --server.headless=true"]
|
| 72 |
|
| 73 |
# Expose Streamlit port
|
| 74 |
EXPOSE 8501
|