Spaces:
Runtime error
Runtime error
Add Docker cache-busting to resolve container-level caching
Browse files- Add CACHEBUST build arg to Dockerfile to invalidate Docker layers
- Copy static files separately before full app copy to break cache
- Add build time logging to app.py for cache debugging
- Add timestamp file to force Docker rebuild
- This should resolve Docker container caching the old green UI files
- .dockerignore-cachebust +0 -0
- Dockerfile +6 -1
- app.py +5 -0
.dockerignore-cachebust
ADDED
|
Binary file (44 Bytes). View file
|
|
|
Dockerfile
CHANGED
|
@@ -19,12 +19,17 @@ WORKDIR /app
|
|
| 19 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 20 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 21 |
|
| 22 |
-
# Copy application files
|
|
|
|
| 23 |
COPY --chown=user . /app
|
| 24 |
|
| 25 |
# Create data directory
|
| 26 |
RUN mkdir -p /app/data && chmod 700 /app/data
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Expose port 7860 as required by HF Spaces
|
| 29 |
EXPOSE 7860
|
| 30 |
|
|
|
|
| 19 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 20 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 21 |
|
| 22 |
+
# Copy application files (copy static files first to break cache)
|
| 23 |
+
COPY --chown=user ./static /app/static
|
| 24 |
COPY --chown=user . /app
|
| 25 |
|
| 26 |
# Create data directory
|
| 27 |
RUN mkdir -p /app/data && chmod 700 /app/data
|
| 28 |
|
| 29 |
+
# Add cache-busting with current timestamp
|
| 30 |
+
ARG CACHEBUST=1
|
| 31 |
+
RUN echo "Cache bust: $CACHEBUST" && ls -la /app/static/
|
| 32 |
+
|
| 33 |
# Expose port 7860 as required by HF Spaces
|
| 34 |
EXPOSE 7860
|
| 35 |
|
app.py
CHANGED
|
@@ -33,6 +33,11 @@ logging.basicConfig(
|
|
| 33 |
)
|
| 34 |
logger = logging.getLogger(__name__)
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Import configuration
|
| 38 |
|
|
|
|
| 33 |
)
|
| 34 |
logger = logging.getLogger(__name__)
|
| 35 |
|
| 36 |
+
# Log build info to help with cache debugging
|
| 37 |
+
import os
|
| 38 |
+
build_time = os.environ.get('BUILD_TIME', 'unknown')
|
| 39 |
+
logger.info(f"TreeTrack starting - Build time: {build_time}")
|
| 40 |
+
|
| 41 |
|
| 42 |
# Import configuration
|
| 43 |
|