0xJacky 2 years ago
parent
commit
2f759f8b20
8 changed files with 50 additions and 8 deletions
  1. 4 3
      Dockerfile
  2. 21 0
      README-zh_TW.md
  3. 21 0
      README.md
  4. 1 1
      build-demo.sh
  5. 1 2
      demo.Dockerfile
  6. 1 1
      frontend/package.json
  7. 1 1
      frontend/version.json
  8. BIN
      nginx-ui

+ 4 - 3
Dockerfile

@@ -5,9 +5,10 @@ EXPOSE 80 443
 
 COPY resources/docker/start.sh /app/start.sh
 COPY resources/docker/nginx.conf /usr/etc/nginx/nginx.conf
-COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/default.conf
-COPY ./nginx-ui /app/nginx-ui
+COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/nginx-ui.conf
+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"]

+ 21 - 0
README-zh_TW.md

@@ -35,6 +35,7 @@ Nginx 網路管理介面,由  [0xJacky](https://jackyu.cn/) 與 [Hintay](https
           <ul>
             <li><a href="#透過執行檔案執行">透過執行檔案執行</a></li>
             <li><a href="#使用-systemd">使用 Systemd</a></li>
+            <li><a href="#使用-docker">使用 Docker</a></li>
           </ul>
         </li>
       </ul>
@@ -158,6 +159,26 @@ systemctl stop nginx-ui
 ```shell
 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
+```
+
 ## 手動構建
 
 對於沒有官方構建版本的平臺,可以嘗試手動構建。

+ 21 - 0
README.md

@@ -33,6 +33,7 @@ Yet another Nginx Web UI, developed by [0xJacky](https://jackyu.cn/) and [Hintay
           <ul>
             <li><a href="#from-executable">From Executable</a></li>
             <li><a href="#with-systemd">With Systemd</a></li>
+            <li><a href="#use-docker">Use Docker</a></li>
           </ul>
         </li>
       </ul>
@@ -157,6 +158,26 @@ systemctl stop nginx-ui
 ```shell
 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
 
 On platforms that do not have an official build version, they can be built manually.

+ 1 - 1
build-demo.sh

@@ -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 \
     "-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 push uozi/nginx-ui-demo

+ 1 - 2
demo.Dockerfile

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

+ 1 - 1
frontend/package.json

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

+ 1 - 1
frontend/version.json

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