Skip to content

Commit f360e72

Browse files
authored
adds docker-compose.yml for local example (#13)
Signed-off-by: Jan Akerman <[email protected]>
1 parent fff066c commit f360e72

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ docker run -d -p 9101:9101 ghcr.io/cpanato/github_actions_exporter-linux-amd64:v
6969
make test
7070
```
7171

72+
### Manual testing
73+
74+
```bash
75+
cd example/
76+
export WEBHOOK_SECRET="..."
77+
export GITHUB_TOKEN="..."
78+
export GITHUB_ORG="..."
79+
docker-compose up --build
80+
```
81+
82+
Open Prometheus at http://localhost:9090 and explore the available metrics.
83+
7284
## Contributing
7385

7486
Refer to [CONTRIBUTING.md](https://github.com/cpanato/github_actions_exporter/blob/master/CONTRIBUTING.md).

example/Dockerfile.dev

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM golang:1.17-alpine as builder
2+
3+
ARG GOARCH="amd64"
4+
ARG GOOS="linux"
5+
6+
WORKDIR /code
7+
COPY . .
8+
9+
RUN go build -o github-actions-exporter .
10+
11+
FROM ghcr.io/distroless/busybox:latest
12+
13+
COPY --from=builder /code/github-actions-exporter /bin/github-actions-exporter
14+
15+
USER nobody
16+
ENTRYPOINT ["/bin/github-actions-exporter"]
17+
EXPOSE 9101

example/docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
3+
services:
4+
github-actions-exporter:
5+
build:
6+
context: ..
7+
dockerfile: example/Dockerfile.dev
8+
command:
9+
- "--gh.github-webhook-token=$WEBHOOK_SECRET"
10+
- "--gh.github-api-token=$GITHUB_TOKEN"
11+
- "--gh.github-org=$GITHUB_ORG"
12+
ports:
13+
- 9101:9101
14+
expose:
15+
- 9101
16+
17+
prometheus:
18+
image: prom/prometheus:v2.34.0
19+
volumes:
20+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
21+
command:
22+
- '--config.file=/etc/prometheus/prometheus.yml'
23+
ports:
24+
- 9090:9090

example/prometheus.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
global:
2+
scrape_interval: 15s
3+
4+
scrape_configs:
5+
- job_name: "prometheus"
6+
scrape_interval: 5s
7+
static_configs:
8+
- targets: ["localhost:9090"]
9+
10+
- job_name: "github-actions-exporter"
11+
static_configs:
12+
- targets: ["github-actions-exporter:9101"]

0 commit comments

Comments
 (0)