Build docker images

This commit is contained in:
2021-01-15 11:30:35 +01:00
parent d4194e6c5e
commit a858411443
3 changed files with 130 additions and 0 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
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//" ) && \
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -tags netgo ./cmd/rc-simulator/
FROM gcr.io/distroless/static
USER 1234
COPY --from=builder /go/src/rc-simulator /go/bin/rc-simulator
ENTRYPOINT ["/go/bin/rc-simulator"]