Skip to content

Commit 9851fe8

Browse files
committed
deploy via docker #20
1 parent 1aa4e70 commit 9851fe8

File tree

16 files changed

+121
-28
lines changed

16 files changed

+121
-28
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ app.ini
77
dist
88
*.exe
99
*.po~
10-
nginx-ui-server
10+
nginx-ui

Dockerfile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# 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-server -v main.go
2-
FROM --platform=linux/amd64 uozi/nginx-ui-demo-debian-base-slim:latest
1+
# 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
2+
FROM --platform=linux/amd64 uozi/nginx-ui-base:latest
33
WORKDIR /app
4-
EXPOSE 80
5-
COPY ./resources/demo/nginx.conf /etc/nginx/sites-available/default
6-
COPY ./resources/demo/app.ini /app/app.ini
7-
COPY ./resources/demo/demo.db /app/database.db
8-
COPY ./resources/demo/start.sh /app/start.sh
9-
COPY ./nginx-ui-server /app/nginx-ui
10-
RUN cd /app && chmod a+x start.sh
11-
CMD ["./start.sh"]
4+
EXPOSE 80 443
5+
6+
COPY resources/docker/start.sh /app/start.sh
7+
COPY resources/docker/nginx.conf /usr/etc/nginx/nginx.conf
8+
COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/default.conf
9+
COPY ./nginx-ui /app/nginx-ui
10+
11+
RUN cd /app && chmod a+x /app/start.sh
12+
13+
ENTRYPOINT ["./start.sh"]

README-zh_CN.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Nginx 网络管理界面,由 [0xJacky](https://jackyu.cn/) 与 [Hintay](https
3535
<ul>
3636
<li><a href="#通过执行文件运行">通过执行文件运行</a></li>
3737
<li><a href="#使用-systemd">使用 Systemd</a></li>
38+
<li><a href="#使用-Docker">使用 Docker</a></li>
3839
</ul>
3940
</li>
4041
</ul>
@@ -158,6 +159,26 @@ systemctl stop nginx-ui
158159
```shell
159160
systemctl restart nginx-ui
160161
```
162+
163+
## 使用 Docker
164+
165+
Docker 示例
166+
- `nginx-ui:latest` 镜像基于 `nginx:latest` 构建,
167+
您可以直接将该镜像监听到 80 和 443 端口以取代宿主机上的 Nginx
168+
169+
- 映射到 `/etc/nginx` 的文件夹应该为一个空目录
170+
171+
```
172+
docker run -dit \
173+
--name=nginx-ui \
174+
--restart=always \
175+
-e TZ=Asia/Shanghai \
176+
-v /mnt/user/appdata/nginx:/etc/nginx \
177+
-v /mnt/user/appdata/nginx-ui:/etc/nginx-ui \
178+
-p 8080:80 -p 8443:443 \
179+
nginx-ui:latest
180+
```
181+
161182
## 手动构建
162183

163184
对于没有官方构建版本的平台,可以尝试手动构建。

build-demo.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
CGO_ENABLED=1 GOOS=linux CC=x86_64-unknown-linux-gnu-gcc \
3+
CXX=x86_64-unknown-linux-gnu-g++ GOARCH=amd64 go build -ldflags \
4+
"-X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go
5+
6+
docker build -t nginx-ui-demo .
7+
docker tag nginx-ui-demo uozi/nginx-ui-demo
8+
docker push uozi/nginx-ui-demo

build.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
2-
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-server -v main.go
3-
docker build -t nginx-ui-demo .
4-
docker tag nginx-ui-demo uozi/nginx-ui-demo
5-
docker push uozi/nginx-ui-demo
2+
CGO_ENABLED=1 GOOS=linux CC=x86_64-unknown-linux-gnu-gcc \
3+
CXX=x86_64-unknown-linux-gnu-g++ GOARCH=amd64 go build -ldflags \
4+
"-X 'github.com/0xJacky/Nginx-UI/server/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go
5+
6+
docker build -t nginx-ui .
7+
docker tag nginx-ui uozi/nginx-ui
8+
docker push uozi/nginx-ui

demo.Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 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
2+
FROM --platform=linux/amd64 uozi/nginx-ui-base:latest
3+
WORKDIR /app
4+
EXPOSE 80
5+
6+
COPY resources/demo/app.ini /etc/nginx-ui/app.ini
7+
COPY resources/demo/demo.db /etc/nginx-ui/database.db
8+
COPY resources/docker/nginx.conf /etc/nginx/nginx.conf
9+
COPY resources/docker/nginx-ui.conf /etc/nginx/conf.d/nginx-ui.conf
10+
COPY resources/docker/start.sh /app/start.sh
11+
COPY nginx-ui /app/nginx-ui
12+
13+
RUN cd /app && chmod a+x start.sh
14+
15+
16+
ENTRYPOINT ["./start.sh"]

frontend/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"1.4.1","build_id":3,"total_build":66}
1+
{"version":"1.4.1","build_id":4,"total_build":67}

nginx-ui

28.2 MB
Binary file not shown.

resources/demo/sources.list

Lines changed: 0 additions & 4 deletions
This file was deleted.

resources/demo/start.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)