File size: 801 Bytes
247f724
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Alpine Linux (Only 5MB base size)
FROM alpine:latest

# Install dependencies
# qemu-system-i386: The emulator
# python3 & py3-numpy: Required for the web bridge
# bash: To run our script
# wget & unzip: To download files
RUN apk add --no-cache \
    qemu-system-i386 \
    qemu-ui-gtk \
    python3 \
    py3-numpy \
    bash \
    wget \
    unzip

# Set working directory
WORKDIR /app

# Create a user (Hugging Face security requirement)
# Alpine uses 'adduser' instead of 'useradd'
RUN adduser -D -u 1000 user
RUN chown -R user:user /app

# Switch to user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Copy the start script
COPY --chown=user:user start.sh /app/start.sh
RUN chmod +x /app/start.sh

# Expose the specific port
EXPOSE 7860

# Run
CMD ["/app/start.sh"]