Debian Codegraph @

Dockerfile

raw
1 FROM ubuntu:focal
2
3 ENV DEBIAN_FRONTEND=noninteractive
4 # apt packages
5 ENV INSTALL_DEPS \
6 ca-certificates \
7 git \
8 make \
9 zip \
10 unzip \
11 g++ \
12 wget \
13 maven \
14 patch \
15 python3 \
16 python3-distutils \
17 python3-setuptools \
18 apt-transport-https \
19 curl \
20 openjdk-8-jdk \
21 gnupg
22
23 RUN apt update \
24 && apt install -y -q --no-install-recommends ${INSTALL_DEPS} \
25 && apt clean
26
27 # bazel
28 ENV BAZEL_VER=6.1.1
29 RUN wget -q -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
32
33 # protoc
34 ENV PROTOC_VER=22.2
35 RUN export PROTOC_REL=protoc-${PROTOC_VER}-linux-$([ $(uname -m) = "aarch64" ] && echo "aarch" || echo "x86")_64.zip \
36 && wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/${PROTOC_REL} \
37 && unzip ${PROTOC_REL} -d protoc \
38 && mv protoc /usr/local \
39 && ln -s /usr/local/protoc/bin/protoc /usr/local/bin \
40 && rm ${PROTOC_REL}
41
42 # go
43 ENV GOROOT /usr/local/go
44 ENV GOPATH /go
45 ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
46 RUN export GORELEASE=go1.19.7.linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64").tar.gz \
47 && wget -q https://dl.google.com/go/$GORELEASE \
48 && tar -C $(dirname $GOROOT) -xzf $GORELEASE \
49 && rm $GORELEASE \
50 && mkdir -p $GOPATH/{src,bin,pkg}
51
52 # protoc-gen-go
53 ENV PGG_VER=v1.30.0
54 RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PGG_VER} \
55 && rm -rf $(go env GOCACHE) \
56 && rm -rf $(go env GOMODCACHE)
57
58 # buildozer
59 ENV BDR_VER=6.0.1
60 RUN go install github.com/bazelbuild/buildtools/buildozer@${BDR_VER} \
61 && rm -rf $(go env GOCACHE) \
62 && rm -rf $(go env GOMODCACHE)
63
64 # python must be on PATH for the execution of py_binary bazel targets, but
65 # the distribution we installed doesn't provide this alias
66 RUN ln -s /usr/bin/python3.8 /usr/bin/python
67
68 WORKDIR ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate
69
70 # python tooling for linting and uploading to PyPI
71 COPY requirements.txt .
72 RUN python3.8 -m easy_install pip \
73 && python3.8 -m pip install -r requirements.txt
74
75 COPY . .
76
77 RUN make build
78
79 ENTRYPOINT ["make"]
80 CMD ["build"]