|
| 1 | +# Copyright 2021 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +FROM golang:1.17 |
| 16 | + |
| 17 | +# Install dependencies |
| 18 | +RUN set -ex; \ |
| 19 | + apt-get update -y; \ |
| 20 | + apt-get install -y \ |
| 21 | + make build-essential libssl-dev zlib1g-dev libbz2-dev \ |
| 22 | + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ |
| 23 | + xz-utils tk-dev libffi-dev liblzma-dev python-openssl \ |
| 24 | + apt-transport-https ca-certificates gnupg curl gnupg-agent lsb-release software-properties-common \ |
| 25 | + unzip wget vim; \ |
| 26 | + rm -rf /var/lib/apt/lists/* |
| 27 | + |
| 28 | +# Install docker |
| 29 | +RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \ |
| 30 | + add-apt-repository \ |
| 31 | + "deb [arch=amd64] https://download.docker.com/linux/debian \ |
| 32 | + $(lsb_release -cs) \ |
| 33 | + stable" && \ |
| 34 | + apt-get update && \ |
| 35 | + apt-get install -y docker-ce docker-ce-cli containerd.io |
| 36 | + |
| 37 | +# Install pyenv |
| 38 | +RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv |
| 39 | + |
| 40 | +ENV PATH /root/.pyenv/bin:$PATH |
| 41 | +ENV PATH /root/.pyenv/shims:$PATH |
| 42 | + |
| 43 | +RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> .bashrc && \ |
| 44 | + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> .bashrc && \ |
| 45 | + echo 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc |
| 46 | + |
| 47 | +# Install Python 3.7 & 3.8, defaults to 3.8 |
| 48 | +RUN for PYTHON_VERSION in 3.7.10 3.8.8; do \ |
| 49 | + pyenv install ${PYTHON_VERSION} && \ |
| 50 | + pyenv global ${PYTHON_VERSION} && \ |
| 51 | + python3 -m pip install --upgrade pip setuptools; done |
| 52 | + |
| 53 | +# Install protoc |
| 54 | +RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip |
| 55 | +RUN unzip protoc-3.13.0-linux-x86_64.zip |
| 56 | +RUN mv bin/protoc /bin/protoc && which protoc |
| 57 | + |
| 58 | +# Install gcloud SDK |
| 59 | +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ |
| 60 | + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && \ |
| 61 | + apt-get install google-cloud-sdk -y |
| 62 | + |
| 63 | +# Install tools used in build |
| 64 | +RUN go install honnef.co/go/tools/cmd/staticcheck@latest && \ |
| 65 | + go install github.com/jstemmer/go-junit-report@latest && \ |
| 66 | + go install golang.org/x/lint/golint@latest && \ |
| 67 | + go install golang.org/x/tools/cmd/goimports@latest |
| 68 | + |
| 69 | +WORKDIR $GOPATH |
0 commit comments