Spaces:
Runtime error
Runtime error
File size: 2,066 Bytes
af56f66 4747aaa af56f66 bacfebc 4747aaa ca9d112 af56f66 092111c af56f66 092111c af56f66 092111c af56f66 092111c af56f66 092111c af56f66 092111c af56f66 4747aaa 422ace0 00a39fa 4747aaa af56f66 8494c0a af56f66 4747aaa 3b170cf 19f8e00 |
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 |
# 使用基础镜像
FROM golang:alpine
# 安装必要的工具
RUN apk update && apk add --no-cache \
curl \
tar \
jq \
openjdk11 # 添加 OpenJDK 11
# 创建新的工作目录
WORKDIR /app
# 下载并解压文件,并给予所有用户读写和执行权限
RUN version=$(basename $(curl -sL -o /dev/null -w %{url_effective} https://github.com/pandora-next/deploy/releases/latest)) \
&& base_url="https://github.com/pandora-next/deploy/releases/expanded_assets/$version" \
&& latest_url="https://github.com/$(curl -sL $base_url | grep "href.*amd64.*\.tar.gz" | sed 's/.*href="//' | sed 's/".*//')" \
&& curl -Lo PandoraNext.tar.gz $latest_url \
&& tar -xzf PandoraNext.tar.gz --strip-components=1 \
&& rm PandoraNext.tar.gz \
&& chmod 777 -R .
# 获取tokens.json
RUN --mount=type=secret,id=TOKENS_JSON,dst=/etc/secrets/TOKENS_JSON \
if [ -f /etc/secrets/TOKENS_JSON ]; then \
cat /etc/secrets/TOKENS_JSON > tokens.json \
&& chmod 777 tokens.json; \
else \
echo "TOKENS_JSON not found, skipping"; \
fi
# 获取config.json
RUN --mount=type=secret,id=CONFIG_JSON,dst=/etc/secrets/CONFIG_JSON \
cat /etc/secrets/CONFIG_JSON > config.json && chmod 777 config.json
# 修改PandoraNext的执行权限
RUN chmod 777 ./PandoraNext
# 创建全局缓存目录并提供最宽松的权限
RUN mkdir /.cache && chmod 777 /.cache
# 创建启动脚本
RUN echo '#!/bin/sh' > start.sh \
&& echo 'JAR_URL=$(curl -s https://api.github.com/repos/Yanyutin753/PandoraNext-TokensTool/releases/latest | grep browser_download_url | grep "pandoraNext.*jar" | cut -d "\"" -f 4)' >> start.sh \
&& echo 'wget -O pandoraNext.jar "${JAR_URL}"' >> start.sh \
&& echo 'java -jar pandoraNext.jar --server.port=8080 --deployWay=releases --deployPosition=default --pandora_Ip=0.0.0.0' >> start.sh \
&& echo './PandoraNext &' >> start.sh \
&& chmod +x start.sh
# 开放端口
EXPOSE 7860 8080
# 启动命令,这里使用 shell 执行 start.sh 脚本
#CMD ["sh", "start.sh"]
CMD ["./PandoraNext"] |