Dockerfile (806B)
1 FROM docker.io/golang:1.22-alpine as builder 2 3 ARG BUILD_VERSION=v0.1 4 5 # fetch latest version from git 6 RUN apk update && apk add --no-cache git 7 RUN git clone https://github.com/dokshukin/go-bastard-operator.git /build 8 WORKDIR /build 9 10 # patch link to project 11 RUN sed -i -E 's#(.*TimeStamp\}\})#\0, https://github.com/dokshukin/go-bastard-operator#' bofh.tmpl 12 13 # build app 14 RUN go mod init main 15 RUN go build -v -ldflags="-X 'main.version=$BUILD_VERSION' -X 'main.timestamp=$(date)'" -o bastard_operator . 16 17 # https://github.com/dokshukin/go-bastard-operator/blob/master/Dockerfile 18 FROM docker.io/alpine:latest 19 20 WORKDIR /app 21 # Copy the Pre-built binary file from the previous stage 22 COPY --from=builder /build/bastard_operator . 23 COPY --from=builder /build/bofh.tmpl . 24 25 EXPOSE 8080/tcp 26 27 CMD ["./bastard_operator"]