FROM bufbuild/buf:1.26.1 AS builder

FROM ubuntu:20.04

RUN apt-get update && apt -y install bash curl unzip git
WORKDIR /opt

RUN \
  curl -L https://golang.org/dl/go1.24.5.linux-amd64.tar.gz > golang.tar.gz && \
  mkdir golang && \
  tar -zxvf golang.tar.gz -C golang/

ENV PATH="${PATH}:/opt/golang/go/bin"

COPY --from=builder /usr/local/bin/buf /usr/local/bin/

# any version changes here should also be bumped in scripts/protobuf_codegen.sh
RUN \
  go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0 && \
  go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0

ENV PATH="${PATH}:/root/go/bin/"
