From 12c4054bce6540221ba1ee8e5987fb5eebf5a636 Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Tue, 10 Nov 2020 22:59:53 -0800 Subject: [PATCH] Shrink docker container --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f07c913..da2f6f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,12 @@ -FROM golang:1.15 as build +FROM golang:1.15-alpine as build WORKDIR /netauth/ldap COPY . . RUN go mod vendor && \ - CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o /ldapd . + CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o /ldapd . && \ + apk add upx binutils && \ + strip /ldapd && \ + upx /ldapd && \ + ls -alh /ldapd FROM scratch LABEL org.opencontainers.image.source https://github.com/netauth/ldap