Skip to content

Commit

Permalink
Chore: build containers
Browse files Browse the repository at this point in the history
- os: linux
- arch: amd64, arm64

Resolves: #84
  • Loading branch information
till committed Sep 6, 2022
1 parent b4039bc commit 7b9195b
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 13 deletions.
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,44 @@ builds:
- windows
env:
- CGO_ENABLED=0
dockers:
- image_templates:
- 'ghcr.io/luzilla/{{.ProjectName}}:{{ .Tag }}-amd64'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
extra_files:
- rbls.ini
- targets.ini
goarch: amd64
- image_templates:
- 'ghcr.io/luzilla/{{.ProjectName}}:{{ .Tag }}-arm64'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
extra_files:
- rbls.ini
- targets.ini
goarch: arm64
docker_manifests:
- name_template: ghcr.io/luzilla/{{.ProjectName}}:{{ .Tag }}
image_templates:
- ghcr.io/luzilla/{{.ProjectName}}:{{ .Tag }}-amd64
- ghcr.io/luzilla/{{.ProjectName}}:{{ .Tag }}-arm64
archives:
- files:
- none*
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3

ENV DNSBL_EXP_RESOLVER=ubound:53
ENV DNSBL_EXP_RBLS=/etc/dnsbl-exporter/rbls.ini
ENV DNSBL_EXP_TARGETS=/etc/dnsbl-exporter/targets.ini

COPY dnsbl-exporter /usr/bin/

RUN mkdir -p /etc/dnsbl-exporter
COPY rbls.ini /etc/dnsbl-exporter/
COPY targets.ini /etc/dnsbl-exporter/

EXPOSE 9211

ENTRYPOINT ["/usr/bin/dnsbl-exporter"]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ GO_VERSION:=1.16
build:
goreleaser build --snapshot --single-target --rm-dist

.PHONY: snapshot
snapshot:
goreleaser build --snapshot --rm-dist

.PHONY: test
test:
docker run \
Expand Down
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,43 @@ $ dnsbl-exporter -h

Go to http://127.0.0.1:9211/ in your browser.

#### Quering
#### Container

Docker/OCI images are available in the [container registry](/~https://github.com/orgs/Luzilla/packages?repo_name=dnsbl_exporter):

```sh
$ docker pull ghcr.io/luzilla/dnsbl_exporter:vX.Y.Z
...
```

Please note: `latest` is not provided.

The images expect `target.ini` and `rbls.ini` in the following location:

```sh
/etc/dnsbl-exporter
```

Either start the container and supply the contents, or build your own image:

```sh
docker run \
--rm \
-e DNSBL_EXP_RESOLVER=your.resolver:53 \
-p 9211:9211 \
-v ./conf:/etc/dnsbl-exporter \
ghcr.io/luzilla/dnsbl_exporter:vA.B.C
```

```docker
FROM ghcr.io/luzilla/dnsbl_exporter:vA.B.C
ADD my-target.ini /etc/dnsbl-exporter/target.ini
ADD my-rbls.ini /etc/dnsbl-exporter/rbls.ini
```


#### Querying

The individual configured servers and their status are represented by a **gauge**:

Expand Down
28 changes: 16 additions & 12 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,28 @@ func NewApp(name string, version string) DNSBLApp {
app.Version = version
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config.dns-resolver",
Value: "127.0.0.1:53",
Usage: "IP address[:port] of the resolver to use.",
Name: "config.dns-resolver",
Value: "127.0.0.1:53",
Usage: "IP address[:port] of the resolver to use.",
EnvVar: "DNSBL_EXP_RESOLVER",
},
cli.StringFlag{
Name: "config.rbls",
Value: "./rbls.ini",
Usage: "Configuration file which contains RBLs",
Name: "config.rbls",
Value: "./rbls.ini",
Usage: "Configuration file which contains RBLs",
EnvVar: "DNSBL_EXP_RBLS",
},
cli.StringFlag{
Name: "config.targets",
Value: "./targets.ini",
Usage: "Configuration file which contains the targets to check.",
Name: "config.targets",
Value: "./targets.ini",
Usage: "Configuration file which contains the targets to check.",
EnvVar: "DNSBL_EXP_TARGETS",
},
cli.StringFlag{
Name: "web.listen-address",
Value: ":9211",
Usage: "Address to listen on for web interface and telemetry.",
Name: "web.listen-address",
Value: ":9211",
Usage: "Address to listen on for web interface and telemetry.",
EnvVar: "DNSBL_EXP_LISTEN",
},
cli.StringFlag{
Name: "web.telemetry-path",
Expand Down

0 comments on commit 7b9195b

Please sign in to comment.