File size: 1,339 Bytes
8ed4d8b
 
 
 
 
 
 
 
 
 
 
 
ca04d92
 
 
8ed4d8b
 
9b5dfdf
 
 
 
 
8ed4d8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM ubuntu:22.04

# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Update system and install required packages
RUN apt-get update && apt-get install -y \
    curl \
    git \
    python3 \
    rclone \
    inotify-tools \
    zip \
    unzip \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Install File Browser by downloading the binary directly from GitHub releases
RUN curl -fsSL https://github.com/filebrowser/filebrowser/releases/download/v2.32.0/linux-amd64-filebrowser.tar.gz -o filebrowser.tar.gz && \
    tar -xzf filebrowser.tar.gz && \
    mv filebrowser /usr/bin/ && \
    rm filebrowser.tar.gz LICENSE README.md

# Create a non-root user matching Hugging Face Space UID (1000)
RUN useradd -m -u 1000 user && \
    mkdir -p /data && \
    chown -R user:user /data

# Set user home and workspace
ENV HOME=/home/user
WORKDIR $HOME

# Switch to the non-root user
USER user

# Create directories for File Browser configuration and database
RUN mkdir -p $HOME/setup_guide

# Copy setup guide and entrypoint script
COPY --chown=user:user setup_guide/index.html $HOME/setup_guide/index.html
COPY --chown=user:user entrypoint.sh $HOME/entrypoint.sh
RUN chmod +x $HOME/entrypoint.sh

# Expose Hugging Face Space default port
EXPOSE 7860

# Set entrypoint
CMD ["/home/user/entrypoint.sh"]