From c90f46ab7e4aa14f1ef77674a113781464c4daba Mon Sep 17 00:00:00 2001 From: Maciej Wereski Date: Wed, 27 Jan 2021 17:10:40 +0100 Subject: [PATCH 1/2] Dockerfile: bump Go to 1.15 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8bd81d0..4451057 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14 +FROM golang:1.15 RUN mkdir /app WORKDIR /app From 0e6ba17163a9755457d8750f78e161de50a52be6 Mon Sep 17 00:00:00 2001 From: Maciej Wereski Date: Wed, 27 Jan 2021 17:51:57 +0100 Subject: [PATCH 2/2] Dockerfile: split into two stages This shrinks resulting image size. On my amd64 system it went from 1.01 GB to 25.1 MB. --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4451057..c066462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.15 +FROM golang:1.15 as build RUN mkdir /app WORKDIR /app @@ -6,8 +6,12 @@ ARG VERSION ADD . /app/ RUN go build -ldflags=-s -ldflags=-w -ldflags=-X=github.com/miguelmota/cointop/cointop.version=$VERSION -o main . -RUN mv main /bin/cointop -RUN git clone https://github.com/cointop-sh/colors ~/.config/cointop/colors +RUN git clone https://github.com/cointop-sh/colors && rm -Rf colors/.git* +FROM busybox:glibc +RUN mkdir -p /etc/ssl +COPY --from=build /etc/ssl/certs/ /etc/ssl/certs +COPY --from=build /app/main /bin/cointop +COPY --from=build /app/colors /root/.config/cointop/colors ENTRYPOINT cointop CMD []