File size: 1,559 Bytes
6a01e7d
eaa7479
 
 
 
 
 
 
 
 
 
 
e3a3799
 
 
eaa7479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5f5a80
eaa7479
e3a3799
eaa7479
 
 
a5f5a80
eaa7479
 
e3a3799
eaa7479
a5f5a80
e3a3799
eaa7479
e3a3799
 
eaa7479
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM docker.io/library/python:3.11

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    git-lfs \
    ffmpeg \
    libsm6 \
    libxext6 \
    cmake \
    rsync \
    libgl1 \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

# Upgrade pip and install base packages
RUN pip install --no-cache-dir pip -U && \
    pip install --no-cache-dir \
    datasets \
    "huggingface-hub>=0.19" \
    "hf_xet>=1.0.0,<2.0.0" \
    "hf-transfer>=0.1.4" \
    "protobuf<4" \
    "click<8.1" \
    "pydantic==2.10.6"

# Set working directory
WORKDIR /home/user/app

# Install fakeroot and setup user
RUN apt-get update && apt-get install -y fakeroot && \
    mv /usr/bin/apt-get /usr/bin/.apt-get && \
    echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
    chmod +x /usr/bin/apt-get && \
    rm -rf /var/lib/apt/lists/* && \
    useradd -m -u 1000 user

# Install Node.js
RUN apt-get update && \
    apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/* && apt-get clean

# Copy and install requirements
COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Copy application files
COPY --chown=1000:1000 . .

# Switch to user
USER user

# Expose port (adjust as needed)
EXPOSE 7860

# Set environment variables
ENV GRADIO_SERVER_NAME="0.0.0.0"

# Run the application (adjust command as needed)
CMD ["python", "app.py"]