Q58Bot/Dockerfile.multi
2024-09-18 01:27:32 +08:00

26 lines
584 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
# 创建工作目录
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 chmod +x main
# 运行应用
CMD ["./main"]