Skip to content

Commit 4f96300

Browse files
author
Elliot Jackson
authored
Upgrade build dependencies (#629)
* Support arm64 and amd64 in Dockerfile Signed-off-by: Elliot Jackson <[email protected]> * upgrade go dependencies Signed-off-by: Elliot Jackson <[email protected]> * fix Dockerfile syntax Signed-off-by: Elliot Jackson <[email protected]> * update bazel dependencies Signed-off-by: Elliot Jackson <[email protected]> * add protobuf python dependency Signed-off-by: Elliot Jackson <[email protected]> * clean up cache after go install in dockerfile Signed-off-by: Elliot Jackson <[email protected]> * clean mod cache on each install Signed-off-by: Elliot Jackson <[email protected]> * upgrade go toolchain version to 1.19.1 Signed-off-by: Elliot Jackson <[email protected]> Signed-off-by: Elliot Jackson <[email protected]>
1 parent 61feee2 commit 4f96300

File tree

17 files changed

+1346
-78
lines changed

17 files changed

+1346
-78
lines changed

BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ go_library(
2222
visibility = ["//visibility:private"],
2323
deps = [
2424
"//module",
25-
"@org_golang_google_protobuf//types/pluginpb",
2625
"@com_github_lyft_protoc_gen_star//:protoc-gen-star",
2726
"@com_github_lyft_protoc_gen_star//lang/go",
27+
"@org_golang_google_protobuf//types/pluginpb",
2828
],
2929
)

Dockerfile

+31-20
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
FROM ubuntu:focal
22

3-
3+
ENV DEBIAN_FRONTEND=noninteractive
44
# apt packages
55
ENV INSTALL_DEPS \
6-
bazel \
76
ca-certificates \
87
git \
98
make \
9+
zip \
1010
unzip \
11+
g++ \
1112
wget \
1213
maven \
1314
patch \
1415
python3 \
1516
python3-distutils \
16-
python3-setuptools
17-
18-
RUN apt update && apt install -y -q --no-install-recommends curl openjdk-8-jdk gnupg
17+
python3-setuptools \
18+
apt-transport-https \
19+
curl \
20+
openjdk-8-jdk \
21+
gnupg
1922

20-
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \
21-
&& curl https://bazel.build/bazel-release.pub.gpg | apt-key add - \
22-
&& apt update \
23+
RUN apt update \
2324
&& apt install -y -q --no-install-recommends ${INSTALL_DEPS} \
24-
&& apt clean \
25-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
25+
&& apt clean
26+
27+
# bazel
28+
ENV BAZEL_VER=5.3.0
29+
RUN wget -O bazel https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "x86_64") \
30+
&& chmod +x bazel \
31+
&& mv bazel usr/local/bin/bazel
2632

2733
# protoc
28-
ENV PROTOC_VER=3.17.3
29-
ENV PROTOC_REL=protoc-"${PROTOC_VER}"-linux-x86_64.zip
30-
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v"${PROTOC_VER}/${PROTOC_REL}" \
34+
ENV PROTOC_VER=21.5
35+
RUN export PROTOC_REL=protoc-${PROTOC_VER}-linux-$([ $(uname -m) = "aarch64" ] && echo "aarch" || echo "x86")_64.zip \
36+
&& wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/${PROTOC_REL} \
3137
&& unzip ${PROTOC_REL} -d protoc \
3238
&& mv protoc /usr/local \
3339
&& ln -s /usr/local/protoc/bin/protoc /usr/local/bin
@@ -36,18 +42,23 @@ RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v"${PROTO
3642
ENV GOROOT /usr/local/go
3743
ENV GOPATH /go
3844
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
39-
ENV GORELEASE go1.17.linux-amd64.tar.gz
40-
RUN wget -q https://dl.google.com/go/$GORELEASE \
41-
&& tar -C $(dirname $GOROOT) -xzf $GORELEASE \
42-
&& rm $GORELEASE \
43-
&& mkdir -p $GOPATH/{src,bin,pkg}
45+
RUN export GORELEASE=go1.19.1.linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64").tar.gz \
46+
&& wget -q https://dl.google.com/go/$GORELEASE \
47+
&& tar -C $(dirname $GOROOT) -xzf $GORELEASE \
48+
&& rm $GORELEASE \
49+
&& mkdir -p $GOPATH/{src,bin,pkg}
4450

4551
# protoc-gen-go
4652
ENV PGG_VER=v1.27.1
47-
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PGG_VER}
53+
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PGG_VER} \
54+
&& rm -rf $(go env GOCACHE) \
55+
&& rm -rf $(go env GOMODCACHE)
4856

4957
# buildozer
50-
RUN go get github.com/bazelbuild/buildtools/buildozer
58+
ENV BDR_VER=5.1.0
59+
RUN go install github.com/bazelbuild/buildtools/buildozer@${BDR_VER} \
60+
&& rm -rf $(go env GOCACHE) \
61+
&& rm -rf $(go env GOMODCACHE)
5162

5263
WORKDIR ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate
5364
COPY . .

bazel/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ string_flag(
1111
build_setting_default = "",
1212
visibility = ["//visibility:public"],
1313
)
14-

bazel/dependency_imports.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def _pgv_pip_dependencies():
1515
def _pgv_go_dependencies():
1616
go_rules_dependencies()
1717
go_register_toolchains(
18-
version = "1.15.6",
18+
version = "1.19.1",
1919
)
2020
gazelle_dependencies()
2121

bazel/repositories.bzl

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ def pgv_dependencies(maven_repos = _DEFAULT_REPOSITORIES):
88
if not native.existing_rule("io_bazel_rules_go"):
99
http_archive(
1010
name = "io_bazel_rules_go",
11-
sha256 = "6f111c57fd50baf5b8ee9d63024874dd2a014b069426156c55adbf6d3d22cb7b",
11+
sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369",
1212
urls = [
13-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.0.tar.gz",
14-
"https://github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.0.tar.gz",
13+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
14+
"https://github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
1515
],
1616
)
1717

1818
if not native.existing_rule("bazel_gazelle"):
1919
http_archive(
2020
name = "bazel_gazelle",
21-
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
21+
sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
2222
urls = [
23-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
24-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
23+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
24+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
2525
],
2626
)
2727

@@ -129,8 +129,9 @@ def pgv_dependencies(maven_repos = _DEFAULT_REPOSITORIES):
129129
if not native.existing_rule("rules_python"):
130130
http_archive(
131131
name = "rules_python",
132-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
133-
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
132+
sha256 = "b593d13bb43c94ce94b483c2858e53a9b811f6f10e1e0eedc61073bd90e58d9c",
133+
strip_prefix = "rules_python-0.12.0",
134+
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.12.0.tar.gz",
134135
)
135136

136137
if not native.existing_rule("rules_proto"):

0 commit comments

Comments
 (0)