File size: 880 Bytes
b2d9e47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    git \
    openssl \
    ca-certificates \
    tini \
    && rm -rf /var/lib/apt/lists/*

# Set up HF Spaces user (uid 1000 required)
RUN useradd -m -u 1000 user

# Set up workdir
WORKDIR /app

# Copy python dependencies and install
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# Copy application files
COPY --chown=user:user src /app/src
COPY --chown=user:user start.sh /app/start.sh
COPY --chown=user:user sync.py /app/sync.py

# Give permissions
RUN chmod +x /app/start.sh && chown -R user:user /app /home/user

# Switch to the non-root user
USER user

# Set environment
ENV HOME=/home/user

# Expose the standard HF port
EXPOSE 7860

ENTRYPOINT ["/usr/bin/tini", "--", "/app/start.sh"]