This commit is contained in:
0xJacky 2022-07-23 14:03:08 +08:00
parent 9851fe8fca
commit 2f759f8b20
8 changed files with 50 additions and 8 deletions

View file

@ -5,9 +5,10 @@ EXPOSE 80 443
COPY resources/docker/start.sh /app/start.sh COPY resources/docker/start.sh /app/start.sh
COPY resources/docker/nginx.conf /usr/etc/nginx/nginx.conf COPY resources/docker/nginx.conf /usr/etc/nginx/nginx.conf
COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/default.conf COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/nginx-ui.conf
COPY ./nginx-ui /app/nginx-ui COPY resources/docker/nginx-ui.conf /etc/nginx/conf.d/nginx-ui.conf
COPY nginx-ui /app/nginx-ui
RUN cd /app && chmod a+x /app/start.sh RUN cd /app && chmod a+x /app/start.sh && rm -f /etc/nginx/conf.d/default.conf
ENTRYPOINT ["./start.sh"] ENTRYPOINT ["./start.sh"]

View file

@ -35,6 +35,7 @@ Nginx 網路管理介面,由 [0xJacky](https://jackyu.cn/) 與 [Hintay](https
<ul> <ul>
<li><a href="#透過執行檔案執行">透過執行檔案執行</a></li> <li><a href="#透過執行檔案執行">透過執行檔案執行</a></li>
<li><a href="#使用-systemd">使用 Systemd</a></li> <li><a href="#使用-systemd">使用 Systemd</a></li>
<li><a href="#使用-docker">使用 Docker</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -158,6 +159,26 @@ systemctl stop nginx-ui
```shell ```shell
systemctl restart nginx-ui systemctl restart nginx-ui
``` ```
## 使用 Docker
Docker 示例
- `nginx-ui:latest` 鏡像基於 `nginx:latest` 構建,
您可以直接將該鏡像監聽到 80 和 443 端口以取代宿主機上的 Nginx
- 映射到 `/etc/nginx` 的文件夾應該為一個空目錄
```
docker run -dit \
--name=nginx-ui \
--restart=always \
-e TZ=Asia/Shanghai \
-v /mnt/user/appdata/nginx:/etc/nginx \
-v /mnt/user/appdata/nginx-ui:/etc/nginx-ui \
-p 8080:80 -p 8443:443 \
nginx-ui:latest
```
## 手動構建 ## 手動構建
對於沒有官方構建版本的平臺,可以嘗試手動構建。 對於沒有官方構建版本的平臺,可以嘗試手動構建。

View file

@ -33,6 +33,7 @@ Yet another Nginx Web UI, developed by [0xJacky](https://jackyu.cn/) and [Hintay
<ul> <ul>
<li><a href="#from-executable">From Executable</a></li> <li><a href="#from-executable">From Executable</a></li>
<li><a href="#with-systemd">With Systemd</a></li> <li><a href="#with-systemd">With Systemd</a></li>
<li><a href="#use-docker">Use Docker</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -157,6 +158,26 @@ systemctl stop nginx-ui
```shell ```shell
systemctl restart nginx-ui systemctl restart nginx-ui
``` ```
## Use Docker
Docker deploy example
- `nginx-ui:latest` base on `nginx:latest`, you can replace the Nginx on host by publishing port 80 and 443 to host
- The volume mapping to `/etc/nginx` should be empty.
```
docker run -dit \
--name=nginx-ui \
--restart=always \
-e TZ=Asia/Shanghai \
-v /mnt/user/appdata/nginx:/etc/nginx \
-v /mnt/user/appdata/nginx-ui:/etc/nginx-ui \
-p 8080:80 -p 8443:443 \
nginx-ui:latest
```
## Manual Build ## Manual Build
On platforms that do not have an official build version, they can be built manually. On platforms that do not have an official build version, they can be built manually.

View file

@ -3,6 +3,6 @@ CGO_ENABLED=1 GOOS=linux CC=x86_64-unknown-linux-gnu-gcc \
CXX=x86_64-unknown-linux-gnu-g++ GOARCH=amd64 go build -ldflags \ CXX=x86_64-unknown-linux-gnu-g++ GOARCH=amd64 go build -ldflags \
"-X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go "-X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go
docker build -t nginx-ui-demo . docker build -f demo.Dockerfile -t nginx-ui-demo .
docker tag nginx-ui-demo uozi/nginx-ui-demo docker tag nginx-ui-demo uozi/nginx-ui-demo
docker push uozi/nginx-ui-demo docker push uozi/nginx-ui-demo

View file

@ -10,7 +10,6 @@ COPY resources/docker/nginx-ui.conf /etc/nginx/conf.d/nginx-ui.conf
COPY resources/docker/start.sh /app/start.sh COPY resources/docker/start.sh /app/start.sh
COPY nginx-ui /app/nginx-ui COPY nginx-ui /app/nginx-ui
RUN cd /app && chmod a+x start.sh RUN cd /app && chmod a+x start.sh && rm -f /etc/nginx/conf.d/default.conf
ENTRYPOINT ["./start.sh"] ENTRYPOINT ["./start.sh"]

View file

@ -1,6 +1,6 @@
{ {
"name": "nginx-ui-frontend", "name": "nginx-ui-frontend",
"version": "1.4.1", "version": "1.4.2",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --port 8021", "serve": "vue-cli-service serve --port 8021",

View file

@ -1 +1 @@
{"version":"1.4.1","build_id":4,"total_build":67} {"version":"1.4.2","build_id":1,"total_build":68}

BIN
nginx-ui

Binary file not shown.