This repository has been archived by the owner on Aug 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
124 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# BUILD: | ||
# docker build --force-rm=true -t openvpn_exporter . | ||
|
||
# RUN: | ||
# docker run -it -p 9176:9176 -v /path/to/openvpn_server.status:/etc/openvpn_exporter/server.status openvpn_exporter | ||
|
||
FROM golang as builder | ||
|
||
RUN mkdir /app | ||
RUN mkdir /go/src/app | ||
ADD . /go/src/app | ||
WORKDIR /go/src/app | ||
|
||
# Go dep | ||
RUN go get -d ./... | ||
|
||
# Build a standalone binary | ||
RUN set -ex && \ | ||
CGO_ENABLED=0 go build \ | ||
-tags netgo \ | ||
-o /app/openvpn_exporter \ | ||
-v -a \ | ||
-ldflags '-extldflags "-static"' && \ | ||
ls | ||
|
||
# Create the second stage with a basic image. | ||
# this will drop any previous | ||
# stages (defined as `FROM <some_image> as <some_name>`) | ||
# allowing us to start with a fat build image and end up with | ||
# a very small runtime image. | ||
|
||
FROM busybox | ||
|
||
# add compiled binary | ||
COPY --from=builder /app/openvpn_exporter /openvpn_exporter | ||
|
||
# add a default file to be processed | ||
ADD examples/server2.status /etc/openvpn_exporter/server.status | ||
|
||
# run | ||
EXPOSE 9176 | ||
CMD ["/openvpn_exporter", "-openvpn.status_paths", "/etc/openvpn_exporter/server.status"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters