Skip to content

Commit

Permalink
Pin version of protoc-gen-go
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Mason <amason@slack-corp.com>
  • Loading branch information
ajm188 committed Aug 10, 2020
1 parent cf78b7f commit d57b93c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions docker/proto/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
FROM golang:1.14-buster

ARG PROTOC_VERSION=3.12.4

# Install depedencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
unzip \
wget && \
go get \
golang.org/x/tools/cmd/goimports \
github.com/golang/protobuf/protoc-gen-go && \
go install \
wget

ARG PROTOC_GEN_GO_VERSION=v1.3.2

# Need to set up a module in order to install a specific version of protoc-gen-go.
# 1. The `go get package@version` syntax is only supported in module mode.
# 2. In module mode, `go get` is unsupported outside of a module.
# These two things together force us to do this quick hack.
#
# See https://github.com/golang/go/issues/24250 as just one of many issues on the subject.
RUN mkdir proto-builder && \
cd proto-builder && \
go mod init proto-builder && \
GO111MODULE=on go get \
golang.org/x/tools/cmd/goimports \
github.com/golang/protobuf/protoc-gen-go
github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_GO_VERSION}

ARG PROTOC_VERSION=3.12.4

# Download protoc
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
Expand Down

0 comments on commit d57b93c

Please sign in to comment.