Update Dockerfile
Browse files- Dockerfile +11 -12
Dockerfile
CHANGED
|
@@ -1,17 +1,16 @@
|
|
| 1 |
-
#
|
| 2 |
FROM golang:alpine AS builder
|
| 3 |
|
| 4 |
-
#
|
| 5 |
RUN apk update && apk add --no-cache \
|
| 6 |
curl \
|
| 7 |
tar \
|
| 8 |
jq
|
| 9 |
|
| 10 |
-
#
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
|
| 14 |
-
# 下载并解压文件,并给予所有用户读写和执行权限
|
| 15 |
RUN version=$(basename $(curl -sL -o /dev/null -w %{url_effective} https://github.com/pandora-next/deploy/releases/latest)) \
|
| 16 |
&& base_url="https://github.com/pandora-next/deploy/releases/expanded_assets/$version" \
|
| 17 |
&& latest_url="https://github.com/$(curl -sL $base_url | grep "href.*amd64.*\.tar.gz" | sed 's/.*href="//' | sed 's/".*//')" \
|
|
@@ -20,7 +19,7 @@ RUN version=$(basename $(curl -sL -o /dev/null -w %{url_effective} https://githu
|
|
| 20 |
&& rm PandoraNext.tar.gz \
|
| 21 |
&& chmod 777 -R .
|
| 22 |
|
| 23 |
-
#
|
| 24 |
RUN --mount=type=secret,id=TOKENS_JSON,dst=/etc/secrets/TOKENS_JSON \
|
| 25 |
if [ -f /etc/secrets/TOKENS_JSON ]; then \
|
| 26 |
cat /etc/secrets/TOKENS_JSON > tokens.json \
|
|
@@ -29,18 +28,18 @@ RUN --mount=type=secret,id=TOKENS_JSON,dst=/etc/secrets/TOKENS_JSON \
|
|
| 29 |
echo "TOKENS_JSON not found, skipping"; \
|
| 30 |
fi
|
| 31 |
|
| 32 |
-
#
|
| 33 |
RUN --mount=type=secret,id=CONFIG_JSON,dst=/etc/secrets/CONFIG_JSON \
|
| 34 |
cat /etc/secrets/CONFIG_JSON > config.json && chmod 777 config.json
|
| 35 |
|
| 36 |
-
#
|
| 37 |
RUN chmod 777 ./PandoraNext
|
| 38 |
|
| 39 |
-
#
|
| 40 |
RUN mkdir /.cache && chmod 777 /.cache
|
| 41 |
|
| 42 |
-
#
|
| 43 |
EXPOSE 7860
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
CMD ["./PandoraNext"]
|
|
|
|
| 1 |
+
# Use the base image
|
| 2 |
FROM golang:alpine AS builder
|
| 3 |
|
| 4 |
+
# Install necessary tools
|
| 5 |
RUN apk update && apk add --no-cache \
|
| 6 |
curl \
|
| 7 |
tar \
|
| 8 |
jq
|
| 9 |
|
| 10 |
+
# Create a new working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
# Download and extract files, and give all users read, write, and execute permissions
|
|
|
|
| 14 |
RUN version=$(basename $(curl -sL -o /dev/null -w %{url_effective} https://github.com/pandora-next/deploy/releases/latest)) \
|
| 15 |
&& base_url="https://github.com/pandora-next/deploy/releases/expanded_assets/$version" \
|
| 16 |
&& latest_url="https://github.com/$(curl -sL $base_url | grep "href.*amd64.*\.tar.gz" | sed 's/.*href="//' | sed 's/".*//')" \
|
|
|
|
| 19 |
&& rm PandoraNext.tar.gz \
|
| 20 |
&& chmod 777 -R .
|
| 21 |
|
| 22 |
+
# Get tokens.json
|
| 23 |
RUN --mount=type=secret,id=TOKENS_JSON,dst=/etc/secrets/TOKENS_JSON \
|
| 24 |
if [ -f /etc/secrets/TOKENS_JSON ]; then \
|
| 25 |
cat /etc/secrets/TOKENS_JSON > tokens.json \
|
|
|
|
| 28 |
echo "TOKENS_JSON not found, skipping"; \
|
| 29 |
fi
|
| 30 |
|
| 31 |
+
# Get config.json
|
| 32 |
RUN --mount=type=secret,id=CONFIG_JSON,dst=/etc/secrets/CONFIG_JSON \
|
| 33 |
cat /etc/secrets/CONFIG_JSON > config.json && chmod 777 config.json
|
| 34 |
|
| 35 |
+
# Modify the execution permissions of PandoraNext
|
| 36 |
RUN chmod 777 ./PandoraNext
|
| 37 |
|
| 38 |
+
# Create a global cache directory and provide the most lenient permissions
|
| 39 |
RUN mkdir /.cache && chmod 777 /.cache
|
| 40 |
|
| 41 |
+
# Open port
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
+
# Start command
|
| 45 |
+
CMD ["./PandoraNext"]
|