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