Skip to content

Commit

Permalink
Ensure nsswitch.conf config for netgo
Browse files Browse the repository at this point in the history
  • Loading branch information
yosifkit committed Nov 14, 2022
1 parent 30403f1 commit b9c8662
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
12 changes: 9 additions & 3 deletions 1.18/alpine3.15/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions 1.18/alpine3.16/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions 1.19/alpine3.15/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions 1.19/alpine3.16/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Dockerfile-linux.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ FROM alpine:{{ alpine_version }}

RUN apk add --no-cache ca-certificates

# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# ensure that nsswitch.conf is set up for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.19.3/src/net/conf.go#L227-L303
# - docker run --rm debian grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
# Alpine 3.16 includes nsswitch.conf
RUN set -eux; \
if [ -e /etc/nsswitch.conf ]; then \
grep '^hosts: files dns' /etc/nsswitch.conf; \
else \
echo 'hosts: files dns' > /etc/nsswitch.conf; \
fi
{{ ) else ( -}}
FROM buildpack-deps:{{ env.variant }}-scm

Expand Down

0 comments on commit b9c8662

Please sign in to comment.