mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-09-08 09:06:38 +08:00
feat: remote config
This commit is contained in:
+7
-1
@@ -23,8 +23,14 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
|||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/saveany-bot .
|
COPY --from=builder /app/saveany-bot .
|
||||||
|
COPY entrypoint.sh .
|
||||||
|
|
||||||
ENTRYPOINT ["/app/saveany-bot"]
|
RUN chmod +x /app/saveany-bot && \
|
||||||
|
chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -n "$CONFIG_URL" ]; then
|
||||||
|
echo "[INFO] Downloading config from $CONFIG_URL"
|
||||||
|
if curl -sSLo /app/config.toml "$CONFIG_URL"; then
|
||||||
|
echo "[INFO] Configuration downloaded successfully"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Failed to download config from $CONFIG_URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /app/config.toml ]; then
|
||||||
|
echo "[ERROR] Missing config.toml: 请通过挂载或 CONFIG_URL 提供配置文件"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /app/saveany-bot
|
||||||
Reference in New Issue
Block a user