Spaces:
Paused
Paused
| FROM ubuntu:22.04 | |
| RUN apt-get update && apt-get install -y \ | |
| python3 python3-pip python3-venv \ | |
| wget curl tar gzip bash jq \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN adduser --disabled-password --gecos '' --uid 1000 user | |
| RUN mkdir -p /home/user/data && chown -R user:user /home/user/data | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| ENV VIRTUAL_ENV=$HOME/venv | |
| RUN python3 -m venv $VIRTUAL_ENV | |
| ENV PATH="$VIRTUAL_ENV/bin:$PATH" | |
| RUN pip install --no-cache-dir requests webdavclient3 huggingface_hub | |
| # 获取最新版本的 OpenList 并下载 | |
| RUN LATEST_VERSION=$(curl -s https://api.github.com/repos/OpenListTeam/OpenList/releases/latest | jq -r .tag_name) && \ | |
| wget -q https://github.com/OpenListTeam/OpenList/releases/download/${LATEST_VERSION}/openlist-linux-amd64.tar.gz && \ | |
| tar -xzf openlist-linux-amd64.tar.gz && \ | |
| find . -type f -name "openlist" -exec chmod +x {} \; && \ | |
| find . -type f -name "openlist" -exec mv {} . \; && \ | |
| rm -rf openlist-linux-amd64.tar.gz *linux-amd64* | |
| COPY --chown=user . $HOME/app | |
| COPY --chown=user sync_data.sh $HOME/app/ | |
| RUN chmod +x $HOME/app/sync_data.sh | |
| RUN chown -R user:user /home/user | |
| USER user | |
| CMD ["/bin/bash", "-c", "$HOME/app/sync_data.sh & sleep 15 && ./openlist server"] | |