File size: 1,034 Bytes
a27587f
 
 
 
fa8191e
 
 
 
 
a27587f
 
 
 
 
 
 
 
 
 
 
 
c296d70
 
a27587f
 
 
 
 
c296d70
 
 
 
a27587f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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"]