| 1 |
# Copyright 2022 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 marketplace.gcr.io/google/debian12:latest |
| 16 |
|
| 17 |
# Set environment variables for the Go version and installation |
| 18 |
ENV GO_VERSION 1.24.0 |
| 19 |
ENV PATH /usr/local/go/bin:/root/go/bin:$PATH |
| 20 |
|
| 21 |
RUN apt-get update && \ |
| 22 |
apt-get install -y wget ca-certificates git && \ |
| 23 |
rm -rf /var/lib/apt/lists/* |
| 24 |
|
| 25 |
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -O go.tar.gz && \ |
| 26 |
tar -C /usr/local -xzf go.tar.gz && \ |
| 27 |
rm go.tar.gz |
| 28 |
|
| 29 |
RUN go version |
| 30 |
|
| 31 |
# Copy local code to the container image. |
| 32 |
COPY . /postprocessor/ |
| 33 |
WORKDIR /postprocessor |
| 34 |
|
| 35 |
# go build with no path looks in current directory (/postprocessor) and finds package main |
| 36 |
RUN CGO_ENABLED=0 GOOS=linux go build -v -o post_processor |
| 37 |
|
| 38 |
# Install tools used in build |
| 39 |
RUN (export GOTOOLCHAIN='auto' && \ |
| 40 |
go install honnef.co/go/tools/cmd/staticcheck@latest && \ |
| 41 |
go install github.com/jstemmer/go-junit-report@latest && \ |
| 42 |
go install golang.org/x/lint/golint@latest && \ |
| 43 |
go install golang.org/x/tools/cmd/goimports@latest) |
| 44 |
|
| 45 |
CMD /postprocessor/post_processor |