Q58Bot/Dockerfile.multi

33 lines
708 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用轻量级的基础镜像
FROM alpine:latest
# 安装 ca-certificates通常需要用于 HTTPS
RUN apk --no-cache add ca-certificates
# 设置时区
ENV TZ=Asia/Singapore
# 创建工作目录
WORKDIR /root/
# 复制编译好的可执行文件
COPY main-amd64 main-arm64 ./
# 使用 TARGETARCH 参数来选择正确的二进制文件
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
mv main-amd64 main && rm main-arm64; \
elif [ "$TARGETARCH" = "arm64" ]; then \
mv main-arm64 main && rm main-amd64; \
fi
# 添加调试信息
RUN ls -l
RUN file main
RUN ldd main || echo "ldd not available"
# 设置执行权限
RUN chmod +x main
# 运行应用
CMD ["./main"]