robocar-arduino/Dockerfile

20 lines
539 B
Docker
Raw Permalink Normal View History

2022-08-18 10:59:33 +00:00
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS builder
2019-12-01 21:35:19 +00:00
2019-12-18 22:21:52 +00:00
ARG TARGETPLATFORM
ARG BUILDPLATFORM
2019-12-01 21:35:19 +00:00
WORKDIR /go/src
ADD . .
2019-12-18 22:21:52 +00:00
RUN GOOS=$(echo $TARGETPLATFORM | cut -f1 -d/) && \
GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d/) && \
GOARM=$(echo $TARGETPLATFORM | cut -f3 -d/ | sed "s/v//" ) && \
2020-04-04 10:05:06 +00:00
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -a -tags netgo ./cmd/rc-arduino/
2019-12-01 21:35:19 +00:00
FROM gcr.io/distroless/static
USER 1234
COPY --from=builder /go/src/rc-arduino /go/bin/rc-arduino
ENTRYPOINT ["/go/bin/rc-arduino"]