From 12effa130f274a0c6619b78cf9f6db54d3bcb65c Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Wed, 19 Feb 2020 05:48:50 -0500 Subject: [PATCH] Dockerfile: add nsswitch.conf, update go and dep --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8886290a5..5817008d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM golang:1.12-alpine +FROM golang:1.13-alpine RUN apk update && apk add git RUN wget -O /usr/local/bin/dep \ - https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 \ + https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64 \ && chmod a+x /usr/local/bin/dep WORKDIR $GOPATH/src/github.com/ploxiln/oauth2_proxy/ @@ -14,7 +14,13 @@ RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /usr/local/bin/oauth2_proxy FROM busybox EXPOSE 4180 + +# set up nsswitch.conf for Go's "netgo" implementation +# https://github.com/golang/go/issues/35305 +RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf + COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=0 /usr/local/bin/oauth2_proxy /usr/local/bin/ + USER www-data CMD ["oauth2_proxy"]