Add docker version

This commit is contained in:
LuckyHunter
2021-12-05 15:42:43 +08:00
parent a7d35ba5c5
commit 9d76f90d85
2 changed files with 33 additions and 0 deletions

14
Dockerfile Normal file
View File

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

View File

@@ -35,6 +35,25 @@ systemctl enable x-ui
systemctl restart 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+ - CentOS 7+
- Ubuntu 16+ - Ubuntu 16+