FROM golang:1.16.4 as build
ENV GOPATH /go
RUN mkdir -p $GOPATH/src/mapper
COPY ./ $GOPATH/src/mapper
WORKDIR $GOPATH/src/mapper
RUN CGO_ENABLED=0 GOPROXY=https://goproxy.cn GOARCH=amd64 GOOS=linux go build -trimpath -o $GOPATH/bin/default_mapper .

FROM alpine:3.14.0

RUN apk update && apk add --no-cache ca-certificates curl bash tree tzdata libc6-compat
WORKDIR /
COPY --from=build /go/bin/default_mapper /default_mapper
CMD ["/default_mapper"]