From 0c8029c95036d876701a9e5d726eddb8be3a68c0 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Fri, 15 May 2020 16:41:16 +0300 Subject: [PATCH] Added a Dockerfile to build the tool in a docker container Use an alpine base image. The image size is 40MB. --- .dockerignore | 24 ++++++++++++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a9e6a6b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib +ethdo + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +coverage.html + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +# Vim +*.sw? + +# Local TODO +TODO.md + +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c01d55e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.14.2-alpine3.11 as builder + +RUN apk add build-base + +WORKDIR /app + +COPY go.mod go.sum ./ + +RUN go mod download + +COPY . . + +RUN go build + +FROM alpine:3.11 + +RUN apk add libstdc++ + +WORKDIR /app + +COPY --from=builder /app/ethdo /app + +ENTRYPOINT ["/app/ethdo"] \ No newline at end of file