mfer/Dockerfile

43 lines
1.1 KiB
Docker
Raw Normal View History

2022-02-02 05:36:20 +00:00
## lint image
## current as of 2022-01-25
2022-12-04 07:28:32 +00:00
FROM golangci/golangci-lint:latest AS linter
2022-02-02 05:36:20 +00:00
RUN mkdir -p /build
WORKDIR /build
COPY ./ ./
RUN golangci-lint run
## build image:
# this is golang:1.17.6-buster as of 2022-01-27
FROM golang@sha256:52a48e0239f4d645b20ac268a60361703afe7feb2df5697fa89f72052cb87a3e AS builder
#FROM golang:1.16-buster AS builder
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt install -y make bzip2 curl unzip
# install newer protoc than what comes with buster
ENV PB_REL https://github.com/protocolbuffers/protobuf/releases
RUN curl -LO $PB_REL/download/v3.19.0/protoc-3.19.0-linux-x86_64.zip && \
unzip protoc-3.19.0-linux-x86_64.zip -d /usr/local
2022-02-02 05:36:20 +00:00
RUN mkdir -p /build
WORKDIR /build
COPY go.mod .
COPY go.sum .
COPY ./ ./
2022-02-02 06:30:43 +00:00
# don't lint again during build because there's no golangci-lint in this
# image and we already did it in a previous stage
#RUN make lint
RUN make mfer
#RUN go mod vendor
2022-02-02 05:36:20 +00:00
RUN tar -c . | bzip2 > /src.tbz2
2022-02-02 05:47:30 +00:00
2022-02-02 06:17:13 +00:00
FROM scratch
COPY --from=builder /src.tbz2 /src.tbz2
COPY --from=builder /build/mfer /mfer
ENTRYPOINT ["/mfer"]