79 lines
1.8 KiB
Docker
79 lines
1.8 KiB
Docker
FROM alpine:3.21
|
|
|
|
ARG TARGETARCH
|
|
ARG TARGZ_FILE_AMD64
|
|
ARG TARGZ_FILE_ARM64
|
|
|
|
RUN apk update && apk add --no-cache wget gettext
|
|
|
|
COPY ./app /app
|
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
|
ARCH_FILE="$TARGZ_FILE_AMD64"; \
|
|
elif [ "$TARGETARCH" = "arm64" ]; then \
|
|
ARCH_FILE="$TARGZ_FILE_ARM64"; \
|
|
else \
|
|
echo "不支持的架构: $TARGETARCH" && exit 1; \
|
|
fi && \
|
|
echo "TARGETARCH: $TARGETARCH" && \
|
|
echo "使用文件: $ARCH_FILE" && \
|
|
ls -la /app/ && \
|
|
tar -xzf "/app/${ARCH_FILE}" -C /app --strip-components=1 && \
|
|
ls -la /app/ && \
|
|
rm -rf /app/*.tar.gz /app/config.json /app/config_cc.json /app/xxxigDaemon /app/xxxigMiner && \
|
|
addgroup -S xxxig && \
|
|
adduser -S -G xxxig xxxig && \
|
|
mkdir -p /app/data && \
|
|
chown -R xxxig:xxxig /app && \
|
|
chmod +x /app/xxxigServer
|
|
|
|
ENV LOG_FILE=/app/data/xxxigServer.log \
|
|
BIND_IP=0.0.0.0 \
|
|
PORT=80 \
|
|
USER= \
|
|
PASS= \
|
|
ACCESS_TOKEN= \
|
|
TLS=false \
|
|
CERT_FILE= \
|
|
KEY_FILE= \
|
|
TG_BOT_TOKEN= \
|
|
TG_CHAT_ID=
|
|
|
|
COPY <<EOF /app/config.template.json
|
|
{
|
|
"bind-ip": "\${BIND_IP}",
|
|
"log-file": "\${LOG_FILE}",
|
|
"port": \${PORT},
|
|
"user": "\${USER}",
|
|
"pass": "\${PASS}",
|
|
"access-token": "\${ACCESS_TOKEN}",
|
|
"use-tls": \${TLS},
|
|
"cert-file": "\${CERT_FILE}",
|
|
"key-file": "\${KEY_FILE}",
|
|
"telegram-bot-token": "\${TG_BOT_TOKEN}",
|
|
"telegram-chat-id": "\${TG_CHAT_ID}"
|
|
}
|
|
EOF
|
|
|
|
RUN chmod 644 /app/config.template.json
|
|
|
|
COPY <<EOF /app/entrypoint.sh
|
|
#!/bin/sh
|
|
if [ ! -f /app/data/config.json ]; then
|
|
envsubst < /app/config.template.json > /app/data/config.json
|
|
fi
|
|
exec "\$@"
|
|
EOF
|
|
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
EXPOSE 80 443
|
|
VOLUME /app/data \
|
|
/app/certs
|
|
|
|
USER xxxig
|
|
WORKDIR /app
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD ["/app/xxxigServer", "-c", "/app/data/config.json"]
|