Files
xxxigcc/docker/Dockerfile.Server
Wang Defa 612ec7b521
Some checks failed
Build and Release / build-and-test (alpine) (push) Failing after 53s
Build and Release / build-and-test (ubuntu) (push) Failing after 8m7s
Build and Release / docker-images (push) Has been skipped
Build and Release / release (push) Has been skipped
首次提交
2025-12-02 11:57:14 +08:00

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"]