diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b0714a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:latest AS builder +WORKDIR /root +COPY . . +RUN go build main.go + + +FROM debian:11-slim +RUN apt-get update && apt-get install -y --no-install-recommends -y ca-certificates \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +WORKDIR /root +COPY --from=builder /root/main /root/x-ui +COPY bin/. /root/bin/. +VOLUME [ "/etc/x-ui" ] +CMD [ "./x-ui" ] diff --git a/README.md b/README.md index 1b2831d..56bbecc 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,25 @@ systemctl enable x-ui systemctl restart x-ui ``` +## 使用docker安装 +1. 安装docker +```shell +curl -fsSL https://get.docker.com | sh +``` +2. 安装x-ui +```shell +mkdir x-ui && cd x-ui +docker run -itd --network=host \ + -v $PWD/db/:/etc/x-ui/ \ + -v $PWD/cert/:/root/cert/ \ + --name x-ui --restart=unless-stopped \ + enwaiax/x-ui:latest +``` +>Build 自己的镜像 +```shell +docker build -t x-ui . +``` + ## 建议系统 - CentOS 7+ - Ubuntu 16+