release: 0.1.0
parent
1d55d83799
commit
01562e5389
13
Dockerfile
13
Dockerfile
|
@ -1,14 +1,17 @@
|
|||
FROM golang:1.17.2-alpine3.14 as builder
|
||||
RUN apk update && apk add --no-cache git tzdata
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum /src/
|
||||
RUN go mod download
|
||||
|
||||
# not using any libs, for now
|
||||
|
||||
# COPY go.mod go.sum /src/
|
||||
# RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN VERSION=$(git describe --tags) BUILD=$(git rev-parse --short HEAD) && \
|
||||
RUN VERSION=$(git describe --tags --abbrev=0) BUILD=$(git rev-parse --short HEAD) && \
|
||||
GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w" \
|
||||
-o /go/bin/configui main.go
|
||||
-o /go/bin/configui
|
||||
|
||||
|
||||
FROM alpine:3.14
|
||||
|
@ -16,4 +19,4 @@ EXPOSE 5080
|
|||
ENV PATH="/go/bin:${PATH}"
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
COPY --from=builder /go/bin/configui /go/bin/configui
|
||||
CMD ["/go/bin/configui"]
|
||||
CMD ["/go/bin/configui","-log","/var/log/configui.log","-f","/data/configui.json"]
|
50
Makefile
50
Makefile
|
@ -5,9 +5,15 @@ HUB=hub.kumoly.io
|
|||
HUB_PROJECT=tools
|
||||
|
||||
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w"
|
||||
PLATFORMS=darwin linux
|
||||
ARCHITECTURES=amd64
|
||||
APPS=configui
|
||||
|
||||
default: build
|
||||
|
||||
install:
|
||||
npm install
|
||||
|
||||
clean:
|
||||
rm -rf dist
|
||||
|
||||
|
@ -18,3 +24,47 @@ run: build
|
|||
build:
|
||||
npm run build
|
||||
go build ${LDFLAGS} -o dist/${PROJ}
|
||||
|
||||
|
||||
build-unix:
|
||||
$(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), $(foreach APP, $(APPS),\
|
||||
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(APP)) \
|
||||
$(shell cd dist; tar -czf ${APP}_$(VERSION)_$(GOOS)_$(GOARCH).tar.gz ${APP}) \
|
||||
$(shell rm dist/${APP}) \
|
||||
)))
|
||||
|
||||
build-win:
|
||||
$(foreach APP, $(APPS), \
|
||||
$(shell export GOOS=windows; export GOARCH=amd64; go build ${LDFLAGS} -o dist/${APP}.exe) \
|
||||
$(shell cd dist; tar -czf ${APP}_$(VERSION)_windows_amd64.tar.gz ${APP}.exe) \
|
||||
$(shell rm dist/${APP}.exe) \
|
||||
)
|
||||
|
||||
build-mac-m1:
|
||||
$(foreach APP, $(APPS),\
|
||||
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(APP)) \
|
||||
$(shell cd dist; tar -czf ${APP}_$(VERSION)_darwin_arm64.tar.gz ${APP}) \
|
||||
$(shell rm dist/${APP}) \
|
||||
)
|
||||
|
||||
.PHONY: binary
|
||||
binary: build-unix build-win build-mac-m1
|
||||
|
||||
.PHONY: docker
|
||||
docker:
|
||||
docker build --target builder -t $(HUB)/$(HUB_PROJECT)/$(PROJ):builder .
|
||||
docker build \
|
||||
-t $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) \
|
||||
.
|
||||
|
||||
docker-push:
|
||||
docker tag $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
||||
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION)
|
||||
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
||||
|
||||
docker-save:
|
||||
docker save $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) | gzip > dist/$(PROJ)-image-$(VERSION)-${BUILD}.tar.gz
|
||||
|
||||
|
||||
.PHONY: release
|
||||
release: clean binary docker docker-save
|
|
@ -4,8 +4,10 @@ a web app to edit and action on update powered by [ACE](https://ace.c9.io/#nav=h
|
|||
|
||||
```
|
||||
Usage: configui [options]
|
||||
-allow string
|
||||
IPs to allow, blank to allow all
|
||||
-bind string
|
||||
address to bind (default "localhost:8000")
|
||||
address to bind (default "0.0.0.0:8000")
|
||||
-c string
|
||||
cmd to apply
|
||||
-f string
|
||||
|
@ -16,6 +18,8 @@ Usage: configui [options]
|
|||
alias of file
|
||||
-p string
|
||||
path to file, precedence over config
|
||||
-static
|
||||
disable config api
|
||||
-v show version
|
||||
```
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -45,7 +45,7 @@ func init() {
|
|||
flag.StringVar(&flagAction, "c", "", "cmd to apply")
|
||||
flag.StringVar(&flagLogFile, "log", "", "log to file")
|
||||
flag.StringVar(&flagAllow, "allow", "", "IPs to allow, blank to allow all")
|
||||
flag.StringVar(&flagBind, "bind", "localhost:8000", "address to bind")
|
||||
flag.StringVar(&flagBind, "bind", "0.0.0.0:8000", "address to bind")
|
||||
flag.BoolVar(&flagNoReconfig, "static", false, "disable config api")
|
||||
flag.BoolVar(&flagVer, "v", false, "show version")
|
||||
flag.Usage = func() {
|
||||
|
|
Loading…
Reference in New Issue