From d77bd9c31b08117b682028b8109875cfbcceb8ab Mon Sep 17 00:00:00 2001 From: NC Thompson Date: Tue, 15 Jan 2019 22:38:49 +0200 Subject: [PATCH 1/3] Add dockerfile --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d04e66 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:alpine as builder +RUN apk add build-base linux-headers git +RUN mkdir /build +ADD . /build/ +WORKDIR /build +RUN go build -o invertergui ./cmd/invertergui +FROM alpine +RUN adduser -S -D -H -h /app inverteruser +RUN addgroup inverteruser dialout +USER inverteruser +COPY --from=builder /build/invertergui /app/ +WORKDIR /app +ENTRYPOINT [ "./invertergui" ] +CMD [] \ No newline at end of file From 996b5486c22dba6488fdec9ca3f4bef2c3165b81 Mon Sep 17 00:00:00 2001 From: NC Thompson Date: Sat, 19 Jan 2019 16:06:00 +0200 Subject: [PATCH 2/3] Added docker build to Makefile to allow build call via make --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b9e561..bb05424 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ #OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.PHONY: test install gofmt +.PHONY: test install gofmt docker build: go build ./cmd/invertergui/ @@ -45,3 +45,6 @@ test-race: vet: go vet ./... + +docker: + docker build --tag invertergui . From fa03f977eaaa8bbcfdd447b00086a77f5f95e286 Mon Sep 17 00:00:00 2001 From: NC Thompson Date: Sat, 19 Jan 2019 18:04:35 +0200 Subject: [PATCH 3/3] Update the README with information on how to run the image and the locations of the docker image --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 87cc9b6..9a2deee 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,13 @@ The invertergui allows the monitoring of a [Victron Multiplus](https://www.victronenergy.com/inverters-chargers/multiplus-12v-24v-48v-800va-3kva) via the [MK3/MK2 USB](https://www.victronenergy.com/accessories/interface-mk3-usb) or the MK2 RS232. -The `ncthompson/invertergui` docker image is a build of [invertergui](https://gitlab.com/ncthompson/invertergui) +The [`ncthompson/invertergui`](https://hub.docker.com/r/ncthompson/invertergui) docker image is a build of this repository. + +## Quick Start + +``` +docker run --device /dev/ttyUSB0:/dev/ttyUSB0 -p 8080:8080 ncthompson/invertergui +``` ## Requirements