Create Dockerfile

This commit is contained in:
LOVECHEN 2023-05-06 09:09:13 +08:00 committed by GitHub
parent 78638a9737
commit 7553633257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

19
Dockerfile Normal file
View file

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