forked from compose/transporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
24 lines (16 loc) · 914 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM golang:1.17 as builder
# Setting up working directory
ADD . /go/src/github.com/compose/transporter/
WORKDIR /go/src/github.com/compose/transporter/
ARG VERSION
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o transporter -ldflags="-X main.version=$VERSION" ./cmd/transporter/...
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=builder /go/src/github.com/compose/transporter/transporter /usr/local/bin/
# Alpine Linux doesn't use pam, which means that there is no /etc/nsswitch.conf,
# but Golang relies on /etc/nsswitch.conf to check the order of DNS resolving
# (see https://github.com/golang/go/commit/9dee7771f561cf6aee081c0af6658cc81fac3918)
# To fix this we just create /etc/nsswitch.conf and add the following line:
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
CMD ["/usr/local/bin/transporter"]