From 642ccc7bf57874412b03705da09b0ed02ce292ad Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 4 Oct 2018 19:07:30 -0500 Subject: [PATCH] added docker support --- .dockerignore | 2 ++ Dockerfile | 17 +++++++++++++++++ docker-build.sh | 5 +++++ docker-compose.yml | 7 +++++++ docker-push.sh | 5 +++++ readme.md | 20 +++++++++++++++++++- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 docker-build.sh create mode 100644 docker-compose.yml create mode 100755 docker-push.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ad48949 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/vendor +/dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c5d3ad5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.11.1-alpine + +WORKDIR /go/src/github.com/mgerb/ServerStatus +ADD . . +RUN apk add --no-cache git alpine-sdk +RUN go get -u github.com/golang/dep/cmd/dep +RUN dep ensure +RUN make linux + + +FROM alpine:3.8 + +RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* +WORKDIR /server-status +COPY --from=0 /go/src/github.com/mgerb/ServerStatus/dist/ServerStatus-linux . +ENTRYPOINT ./ServerStatus-linux + diff --git a/docker-build.sh b/docker-build.sh new file mode 100755 index 0000000..8c50acd --- /dev/null +++ b/docker-build.sh @@ -0,0 +1,5 @@ +version=$(git describe --tags) + +docker build -t mgerb/server-status:latest . +docker tag mgerb/server-status:latest mgerb/server-status:$version + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fcbd780 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "2" + +services: + server-status: + image: mgerb/server-status:latest + volumes: + - ./config.json:/server-status/config.json diff --git a/docker-push.sh b/docker-push.sh new file mode 100755 index 0000000..5758e64 --- /dev/null +++ b/docker-push.sh @@ -0,0 +1,5 @@ +version=$(git describe --tags) + +docker push mgerb/server-status:latest; +docker push mgerb/server-status:$version; + diff --git a/readme.md b/readme.md index e09dbfd..5169077 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ This bot will send a chat notification when the status of a server changes (goes I originally made this bot to check if private World of Warcraft servers were up or not. It's actually much more useful than that and can be used for most servers. -NOTE: This bot currently does not work for UDP servers. +NOTE: This bot currently does not have any UDP support. ## Configuration - Download the latest release [here](https://github.com/mgerb/ServerStatus/releases) @@ -25,6 +25,24 @@ it happens to be spamming notifications. - time in seconds - configurable in `config.json` +## With Docker + +``` +docker run -it -v /path/to/your/config.json:/server-status/config.json:ro mgerb/server-status +``` + +### Docker Compose + +``` +version: "2" + +services: + server-status: + image: mgerb/server-status:latest + volumes: + - /path/to/your/config.json:/server-status/config.json +``` + ## Usage To get the current status of your servers simply type `!ServerStatus` in chat.