Spaces:
Running
Running
| 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"] | |