Shrink docker container

This commit is contained in:
Michael Aldridge 2020-11-10 22:59:53 -08:00
parent 9d283c5315
commit 12c4054bce

View file

@ -1,8 +1,12 @@
FROM golang:1.15 as build FROM golang:1.15-alpine as build
WORKDIR /netauth/ldap WORKDIR /netauth/ldap
COPY . . COPY . .
RUN go mod vendor && \ 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 FROM scratch
LABEL org.opencontainers.image.source https://github.com/netauth/ldap LABEL org.opencontainers.image.source https://github.com/netauth/ldap