robocar-record/Dockerfile

20 lines
535 B
Docker
Raw Normal View History

FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS builder
2020-01-26 18:57:32 +00:00
ARG TARGETPLATFORM
ARG BUILDPLATFORM
WORKDIR /go/src
ADD . .
RUN GOOS=$(echo $TARGETPLATFORM | cut -f1 -d/) && \
GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d/) && \
GOARM=$(echo $TARGETPLATFORM | cut -f3 -d/ | sed "s/v//" ) && \
2021-02-22 17:39:09 +00:00
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -a -tags netgo ./cmd/rc-record/
2020-01-26 18:57:32 +00:00
FROM gcr.io/distroless/static
USER 1234
COPY --from=builder /go/src/rc-record /go/bin/rc-record
ENTRYPOINT ["/go/bin/rc-record"]