diff --git a/.gitignore b/.gitignore index 436c3fb..be18648 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,5 @@ jsconfig.json ### Misc ### config.toml -.goreleaser.yml .DS_Store /calert/*.tgz diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..63b6525 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,56 @@ +env: + - GO111MODULE=on + - CGO_ENABLED=0 + - RELEASE_BUILDS=dist/calert_darwin_amd64/calert dist/calert_linux_amd64/calert dist/calert_windows_amd64//calert.exe + +builds: + - binary: calert + goos: + - windows + - darwin + - linux + goarch: + - amd64 + ldflags: + - -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" + +archives: + - format: tar.gz + files: + - config.sample.toml + - README.md + - LICENSE +dockers: + # You can have multiple Docker images. + - + # GOOS of the built binary that should be used. + goos: linux + # GOARCH of the built binary that should be used. + goarch: amd64 + # GOARM of the built binary that should be used. + goarm: '' + # Name templates of the built binaries that should be used. + binaries: + - calert + # Templates of the Docker image names. + image_templates: + - "mrkaran/calert:latest" + - "mrkaran/calert:{{ .Tag }}" + # Skips the docker push. Could be useful if you also do draft releases. + # If set to auto, the release will not be pushed to the docker repository + # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 + # Defaults to false. + skip_push: false + # Path to the Dockerfile (from the project root). + dockerfile: Dockerfile + # If your Dockerfile copies files other than the binary itself, + # you should list them here as well. + # Note that goreleaser will create the same structure inside the temporary + # folder, so if you add `foo/bar.json` here, on your Dockerfile you can + # `COPY foo/bar.json /whatever.json`. + # Also note that the paths here are relative to the folder in which + # goreleaser is being run. + # This field does not support wildcards, you can add an entire folder here + # and use wildcards when you `COPY`/`ADD` in your Dockerfile. + extra_files: + - config.sample.toml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b62d61d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:latest AS deploy +RUN apk --no-cache add ca-certificates +COPY calert / +COPY config.sample.toml /etc/calert/config.toml +VOLUME ["/etc/calert"] +CMD ["./calert", "--config", "/etc/calert/config.toml"] \ No newline at end of file diff --git a/config.toml.sample b/config.sample.toml similarity index 100% rename from config.toml.sample rename to config.sample.toml diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index a21d374..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -ARG GO_VERSION=1.13 -FROM golang:${GO_VERSION}-alpine AS builder -RUN apk update && apk add make git -WORKDIR /calert/ -COPY ./ ./ -ENV CGO_ENABLED=0 GOOS=linux -RUN make build - -FROM alpine:latest AS deploy -RUN apk --no-cache add ca-certificates -WORKDIR /calert/ -COPY --from=builder /calert/ ./ -RUN mkdir -p /etc/calert && cp config.toml.sample /etc/calert/config.toml -# Define data volumes -VOLUME ["/etc/calert"] -CMD ["./calert.bin", "--config.file", "/etc/calert/config.toml"] diff --git a/knsgo b/knsgo new file mode 100755 index 0000000..3fd06b3 Binary files /dev/null and b/knsgo differ