FROM golang:alpine AS builder RUN apk --no-cache --no-progress add make upx WORKDIR /go/src/lolcathost/pathway/ COPY src/*.go VERSION ./ RUN echo Building && \ env CGO_ENABLED=0 GO111MODULE=off go build -trimpath -ldflags="all=-s -w -buildid= -X main.version=$(cat VERSION) -X main.buildtime=$(date +%FT%T%z)" && \ echo Compressing && \ upx pathway > /dev/null FROM scratch COPY --from=builder /go/src/lolcathost/pathway/pathway /pathway EXPOSE 8080 CMD ["/pathway"]