From 2d010326c7967a994e32a5bf4be80188db13b5f1 Mon Sep 17 00:00:00 2001 From: Nanahira <78877@qq.com> Date: Fri, 7 Aug 2020 14:34:47 +0800 Subject: [PATCH] Add a Dockerfile and more configurable environment variables --- Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..62ddbbd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM golang:1.14.2-alpine AS builder + +RUN go env -w GO111MODULE=auto \ + && go env -w CGO_ENABLED=0 \ + && mkdir /build + +WORKDIR /build + +COPY ./ . + +RUN cd /build \ + && go build -ldflags "-s -w -extldflags '-static'" -o cqhttp + +FROM alpine:latest + +COPY --from=builder /build/cqhttp /usr/bin/cqhttp +RUN chmod +x /usr/bin/cqhttp + +WORKDIR /data + +ENTRYPOINT [ "/usr/bin/cqhttp" ]