Skip to content

Commit

Permalink
fix: docker和可执行文件的html保持相同
Browse files Browse the repository at this point in the history
  • Loading branch information
jeessy2 committed Dec 25, 2020
1 parent 3dbcddb commit d3a832f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GO=$(GO_ENV) $(shell which go)
GOROOT=$(shell `which go` env GOROOT)
GOPATH=$(shell `which go` env GOPATH)

build: init bindata $(DIR_SRC)/main.go
build: $(DIR_SRC)/main.go
@$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)

build_docker_image:
Expand All @@ -28,14 +28,13 @@ test-race:

bindata:
@go-bindata -pkg util -o util/staticPages.go static/pages/...
@go-bindata -pkg static -o asserts/html.go -fs -prefix "static/" static/
@go-bindata -pkg asserts -o asserts/html.go -fs -prefix "static/" static/

dev:
@go-bindata -debug -pkg util -o util/staticPages.go static/pages/...

# clean all build result
clean:
@rm -f util/staticPages.go asserts/html.go
@$(GO) clean ./...
@rm -f $(BIN)
@rm -rf ./dist/*
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
- [使用](#使用)
- [直接执行](#直接执行)
- [Docker](#docker)
- [自行编译](#自行编译)
- [使用IPV6](#使用ipv6)
- [Webhook](#webhook)
- [开发&自行编译](#开发自行编译)

<!-- /TOC -->

Expand All @@ -34,7 +34,7 @@

![screenshots](https://raw.githubusercontent.com/jeessy2/ddns-go/master/ddns-web.png)

## 使用
## 使用

### 直接执行

Expand All @@ -45,7 +45,7 @@

### Docker

```
```bash
docker run -d \
--name ddns-go \
--restart=always \
Expand All @@ -56,13 +56,6 @@ docker run -d \
- 在浏览器中打开`http://主机IP:9876`,修改你的配置,成功
- [可选] docker中默认不支持ipv6,需自行探索如何开启

### 自行编译

- 如果喜欢从源代码编译自己的版本,可以使用本项目提供的 Makefile 构建
- 首先使用 `make init` 安装 bindata, `make dev` 动态加载修改后的`wtiting.html`
- 使用 `make build` 即可生成本地编译后的 `ddns-go` 可执行文件
- 使用 `make build_docker_image` 自行编译 Docker 镜像

## 使用IPV6

- 前提:你的电脑或终端能正常获取IPV6,并能正常访问IPV6
Expand All @@ -73,7 +66,8 @@ docker run -d \
- 映像 -> 选择`jeessy/ddns-go` -> 启动 -> 高级设置 -> 网络中勾选`使用与 Docker Host 相同的网络`,高级设置中勾选`启动自动重新启动`
- 在浏览器中打开`http://主机IP:9876`,修改你的配置,成功
- Linux的x86或arm架构,如服务器、xx盒子等等,推荐使用`--net=host`模式,简单点
```

```bash
docker run -d \
--name ddns-go \
--restart=always \
Expand Down Expand Up @@ -105,3 +99,14 @@ docker run -d \
- 只勾选 `自定义关键词`, 输入的关键字必须包含在RequestBody的content中, 如:`你的公网IP变了`
- URL中输入钉钉给你的 `Webhook地址`
- RequestBody中输入 `{"msgtype": "text","text": {"content": "你的公网IP变了:#{ipv4Addr},域名更新结果:#{ipv4Result}"}}`

## 开发&自行编译

- 如果喜欢从源代码编译自己的版本,可以使用本项目提供的 Makefile 构建
- 开发:
- 首先使用 `make init` 安装 bindata
- 使用 `make dev` 动态加载修改后的 `writing.html`
- 编译:
- 如修改了html, 务必使用 `make bindata` 生成编译需要的静态文件
- 使用 `make build` 生成本地编译后的 `ddns-go` 可执行文件
- 使用 `make build_docker_image` 自行编译 Docker 镜像
2 changes: 1 addition & 1 deletion asserts/html.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.15

require (
github.com/aliyun/alibaba-cloud-sdk-go v1.61.439
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions util/staticPages.go

Large diffs are not rendered by default.

0 comments on commit d3a832f

Please sign in to comment.