File size: 864 Bytes
2f235f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d950c2f
2f235f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
FROM python:3.11-slim

# Create non-root user (HF Spaces requires UID 1000)
RUN useradd -m -u 1000 potato

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

# Set working directory
WORKDIR /app

# Copy requirements first for layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt gunicorn

# Copy the application source
COPY . .

# Install potato
RUN pip install --no-cache-dir -e .

# Copy entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Create directories for output
RUN mkdir -p /app/annotation_output && \
    chown -R potato:potato /app

# Switch to non-root user
USER potato

# HuggingFace Spaces expects port 7860
EXPOSE 7860

ENV POTATO_CONFIG=config.yaml
ENV PORT=7860

ENTRYPOINT ["/entrypoint.sh"]