Skip to content

Commit 214e11b

Browse files
feat: add dockerfile and adjust the readme for docker build /running
1 parent cfaa081 commit 214e11b

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM docker.io/library/centos:8 AS builder
2+
3+
LABEL maintainer="Jennings Liu <[email protected]>"
4+
5+
ARG ARCH=amd64
6+
7+
ENV GOROOT /usr/local/go
8+
ENV GOPATH /go
9+
ENV PATH "$GOROOT/bin:$GOPATH/bin:$PATH"
10+
ENV GO_VERSION 1.15.2
11+
ENV GO111MODULE=on
12+
13+
14+
# Build dependencies
15+
16+
RUN yum update -y && \
17+
yum install -y rpm-build make git && \
18+
curl -SL https://dl.google.com/go/go${GO_VERSION}.linux-${ARCH}.tar.gz | tar -xzC /usr/local
19+
RUN mkdir -p /go/src/github.com/ && \
20+
git clone https://github.com/jenningsloy318/redfish_exporter /go/src/github.com/jenningsloy318/redfish_exporter && \
21+
cd /go/src/github.com/jenningsloy318/redfish_exporter && \
22+
make build
23+
24+
FROM docker.io/library/centos:8
25+
26+
COPY --from=builder /go/src/github.com/jenningsloy318/redfish_exporter/build/redfish_exporter /usr/local/bin/redfish_exporter
27+
RUN mkdir /etc/prometheus
28+
COPY config.yml.example /etc/prometheus/redfish_exporter.yml
29+
CMD ["/usr/local/bin/redfish_exporter","--config.file","/etc/prometheus/redfish_exporter.yml"]
30+
31+

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ or build in centos 8 docker image
3636
```sh
3737
make docker-build-centos8
3838
```
39+
or we can also build a docker image using [Dockerfile](./Dockerfile)
3940

4041
## Running
41-
42-
To run redfish_exporter do something like:
43-
```sh
44-
redfish_exporter --config.file=redfish_exporter.yml
45-
```
46-
and run
47-
```sh
48-
redfish_exporter -h
49-
```
50-
for more options.
51-
42+
- running directly on linux
43+
```sh
44+
redfish_exporter --config.file=redfish_exporter.yml
45+
```
46+
and run `redfish_exporter -h
47+
` for more options.
48+
49+
- running in container
50+
51+
Also if you build it as a docker image, you can also run in container, just remember to replace your config `/etc/prometheus/redfish_exporter.yml` in container
5252
## Scraping
5353

5454
We can get the metrics via

0 commit comments

Comments
 (0)