forked from networkservicemesh/cmd-nse-icmp-responder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
26 lines (22 loc) · 805 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
25
26
FROM golang:1.16-buster as go
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
RUN go get github.com/go-delve/delve/cmd/dlv@v1.6.0
RUN go get github.com/edwarnicke/dl
RUN dl https://github.com/spiffe/spire/releases/download/v0.11.1/spire-0.11.1-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /bin --strip=3 ./spire-0.11.1/bin/spire-server ./spire-0.11.1/bin/spire-agent
FROM go as build
WORKDIR /build
COPY go.mod go.sum ./
COPY internal ./internal
RUN go build ./internal/pkg/imports
COPY . .
RUN go build -o /bin/nse-icmp-responder .
FROM build as test
CMD go test -test.v ./...
FROM test as debug
CMD dlv -l :40000 --headless=true --api-version=2 test -test.v ./...
FROM alpine as runtime
COPY --from=build /bin/nse-icmp-responder /bin/nse-icmp-responder
ENTRYPOINT ["/bin/nse-icmp-responder"]