Created
March 30, 2022 11:47
-
-
Save paintmeyellow/efe01eb25ebcea29755cde7315ea879c to your computer and use it in GitHub Desktop.
Protobuf compiler + Go plugin + buf in Docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
buf: | |
build: | |
context: . | |
dockerfile: docker/proto.Dockerfile | |
volumes: | |
- ./:/workspace | |
working_dir: /workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM bufbuild/buf:1.3.0 as buf | |
FROM golang:1.18-alpine | |
RUN apk add --no-cache build-base curl automake autoconf libtool git zlib-dev gcompat | |
ENV PROTOBUF_VERSION="3.19.3" | |
ENV PLUGIN_VERSION="1.27.1" | |
#install compiler https://github.com/protocolbuffers/protobuf | |
RUN mkdir -p /proto && PROTOC_ZIP=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \ | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_ZIP} && \ | |
unzip ${PROTOC_ZIP} -d /root/.local && rm -f ${PROTOC_ZIP} | |
#install go plugin https://github.com/protocolbuffers/protobuf-go | |
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${PLUGIN_VERSION} | |
COPY --from=buf /usr/local/bin/buf /usr/local/bin/buf | |
ENTRYPOINT ["/usr/local/bin/buf"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment