2021-03-26 00:08:02 +03:00
|
|
|
# Get a trusted CA cert bundle
|
|
|
|
FROM alpine:latest as certs
|
|
|
|
RUN apk --update add ca-certificates
|
2020-01-07 03:11:52 +03:00
|
|
|
|
2021-03-26 00:08:02 +03:00
|
|
|
# Build cns
|
2021-09-29 00:17:25 +03:00
|
|
|
FROM golang:1.17 AS builder
|
2021-03-26 00:08:02 +03:00
|
|
|
# Build ars
|
|
|
|
ARG VERSION
|
|
|
|
ARG CNS_AI_PATH
|
|
|
|
ARG CNS_AI_ID
|
2020-01-07 03:11:52 +03:00
|
|
|
|
2021-03-26 00:08:02 +03:00
|
|
|
WORKDIR /usr/local/src/cns
|
2020-01-07 03:11:52 +03:00
|
|
|
|
2021-03-26 00:08:02 +03:00
|
|
|
# Copy the source
|
|
|
|
COPY . .
|
2020-01-07 03:11:52 +03:00
|
|
|
|
2021-03-26 00:08:02 +03:00
|
|
|
# Build cns
|
2021-09-29 00:17:25 +03:00
|
|
|
RUN CGO_ENABLED=0 go build -a -o /usr/local/bin/azure-cns -ldflags "-X main.version="$VERSION" -X "$CNS_AI_PATH"="$CNS_AI_ID"" -gcflags="-dwarflocationlists=true" cns/service/*.go
|
2021-03-26 00:08:02 +03:00
|
|
|
|
|
|
|
# Build aitelemetry
|
2021-09-29 00:17:25 +03:00
|
|
|
RUN CGO_ENABLED=0 go build -a -o /usr/local/bin/azure-vnet-telemetry -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/*.go
|
2021-03-26 00:08:02 +03:00
|
|
|
|
|
|
|
# Copy into final image
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /etc/passwd /etc/passwd
|
|
|
|
COPY --from=builder /etc/group /etc/group
|
|
|
|
COPY --from=builder /usr/local/bin/azure-cns \
|
|
|
|
/usr/local/bin/azure-cns
|
|
|
|
COPY --from=builder /usr/local/bin/azure-vnet-telemetry \
|
|
|
|
/usr/local/bin/azure-vnet-telemetry
|
|
|
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/azure-cns" ]
|
|
|
|
EXPOSE 10090
|