Skip to content

Commit 55e6a66

Browse files
authored
feat(go): add 1.17 image (#163)
1 parent c530aac commit 55e6a66

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

go/cloudbuild-test.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,14 @@ steps:
7777
args: ['-i', 'gcr.io/$PROJECT_ID/go116', '--config', '/workspace/go/go116.yaml', '-v']
7878
waitFor: ['go116-build']
7979

80+
# Go 1.17 build
81+
- name: gcr.io/cloud-builders/docker
82+
args: ['build', '-t', 'gcr.io/$PROJECT_ID/go116', '.']
83+
dir: go/go117
84+
id: go117-build
85+
waitFor: ['-']
86+
- name: gcr.io/gcp-runtimes/structure_test
87+
args: ['-i', 'gcr.io/$PROJECT_ID/go117', '--config', '/workspace/go/go117.yaml', '-v']
88+
waitFor: ['go117-build']
89+
8090
timeout: 7200s

go/cloudbuild.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,23 @@ steps:
7777
args: ['-i', 'gcr.io/$PROJECT_ID/go116', '--config', '/workspace/go/go116.yaml', '-v']
7878
waitFor: ['go116-build']
7979

80+
# Go 1.17 build
81+
- name: gcr.io/cloud-builders/docker
82+
args: ['build', '-t', 'gcr.io/$PROJECT_ID/go117', '.']
83+
dir: go/go117
84+
id: go117-build
85+
waitFor: ['-']
86+
- name: gcr.io/gcp-runtimes/structure_test
87+
args: ['-i', 'gcr.io/$PROJECT_ID/go117', '--config', '/workspace/go/go117.yaml', '-v']
88+
waitFor: ['go117-build']
89+
8090
images:
8191
- gcr.io/$PROJECT_ID/go111
8292
- gcr.io/$PROJECT_ID/go112
8393
- gcr.io/$PROJECT_ID/go113
8494
- gcr.io/$PROJECT_ID/go114
8595
- gcr.io/$PROJECT_ID/go115
8696
- gcr.io/$PROJECT_ID/go116
97+
- gcr.io/$PROJECT_ID/go117
8798

8899
timeout: 7200s

go/go117/Dockerfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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

Comments
 (0)