From 6d413cbe726af20253fa72add9e597f0f57f691b Mon Sep 17 00:00:00 2001 From: Emile Date: Wed, 10 Jun 2020 15:32:30 +0200 Subject: :whale: dockerized --- Dockerfile | 15 +++++++++++++++ README.md | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1c9ddcd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM golang:1.14 as build-env + +WORKDIR /go/src/app +ADD . /go/src/app + +ENV PATH="$GOPATH/bin:$PATH" +ENV GOBIN="$GOPATH/bin" +RUN go env + +RUN go get -d -v ./... +RUN go build -o /go/bin/reqlog main.go + +FROM gcr.io/distroless/base +COPY --from=build-env /go/bin/reqlog / +CMD ["/reqlog"] \ No newline at end of file diff --git a/README.md b/README.md index 4887b79..7f40871 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,13 @@ A simple http logger logging all requests to the http server that is exposed. reset all by sending a POST request to `/resetall` + +## Docker + +Simple Dockerfile included (multistage build → 24.9MB Image). + +```!bash +$ docker build . -t reqlog +… +$ docker run --rm -p 8085:8085 reqlog +``` -- cgit 1.4.1