TreeTrack / Dockerfile
RoyAalekh's picture
Add Docker cache-busting to resolve container-level caching
c296d70
raw
history blame
1.03 kB
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# Use Python 3.11 as base image
FROM python:3.11-slim
# Install system dependencies including Git
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Create user for security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application files (copy static files first to break cache)
COPY --chown=user ./static /app/static
COPY --chown=user . /app
# Create data directory
RUN mkdir -p /app/data && chmod 700 /app/data
# Add cache-busting with current timestamp
ARG CACHEBUST=1
RUN echo "Cache bust: $CACHEBUST" && ls -la /app/static/
# Expose port 7860 as required by HF Spaces
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]