From 75536332570d24c76a9833ce5fd195eb0f3f6c02 Mon Sep 17 00:00:00 2001 From: LOVECHEN Date: Sat, 6 May 2023 09:09:13 +0800 Subject: [PATCH] Create Dockerfile --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7e2f4b4b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:alpine AS builder +ENV CGO_ENABLED 1 +RUN apk add gcc && apk --no-cache --update add build-base +ENV DST_DIR=/opt/x-ui +ENV TMP_DIR=/tmp/x-ui + +WORKDIR ${TMP_DIR} +COPY . . +RUN go build main.go + +FROM alpine:latest +ENV DST_DIR=/opt/x-ui +ENV TMP_DIR=/tmp/x-ui +WORKDIR ${DST_DIR} +COPY --from=builder ${TMP_DIR}/main ${DST_DIR}/x-ui +COPY --from=builder ${TMP_DIR}/bin ${DST_DIR}/bin + +VOLUME [ "/etc/x-ui" ] +CMD ["./x-ui","run"]