File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed
Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,18 @@ RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -O go.tar.gz && \
3737 tar -C /usr/local -xzf go.tar.gz && \
3838 rm go.tar.gz
3939ENV PATH /usr/local/go/bin:$PATH
40+ RUN go version
4041
4142WORKDIR /src
4243
44+ # Copy go.mod and go.sum to download dependencies before copying all the source.
45+ # This allows Docker to cache the dependencies layer.
46+ COPY go.mod go.sum ./
47+ RUN go mod download
48+
4349# Copy all source code.
4450COPY . .
4551
46- RUN go version
47-
4852# Build the librariangen binary.
4953RUN CGO_ENABLED=0 GOOS=linux go build -v -o /librariangen .
5054
@@ -55,6 +59,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -v -o /librariangen .
5559FROM marketplace.gcr.io/google/debian12:latest
5660
5761# Set environment variables for tool versions for easy updates.
62+ ENV GO_VERSION=1.23.0
5863ENV PROTOC_VERSION=25.7
5964ENV GO_PROTOC_PLUGIN_VERSION=1.35.2
6065ENV GO_GRPC_PLUGIN_VERSION=1.3.0
@@ -77,6 +82,7 @@ RUN apt-get update && \
7782 rm -rf /var/lib/apt/lists/*
7883
7984# Install the specific Go version required for compatibility.
85+ # Note: This is needed for the go install commands below.
8086RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -O go.tar.gz && \
8187 tar -C /usr/local -xzf go.tar.gz && \
8288 rm go.tar.gz
Original file line number Diff line number Diff line change 1717
1818timeout : 7200s # 2 hours
1919steps :
20+ # Attempt to pull the latest image to use as a cache source.
21+ - name : gcr.io/cloud-builders/docker
22+ entrypoint : ' bash'
23+ args :
24+ - -c
25+ - |
26+ docker pull us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-latest || exit 0
2027 - name : gcr.io/cloud-builders/docker
2128 args :
2229 [
2330 " build" ,
31+ " --cache-from" ,
32+ " us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-latest" ,
2433 " -t" ,
2534 " us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-$COMMIT_SHA" ,
2635 " -f" ,
@@ -29,14 +38,17 @@ steps:
2938 ]
3039 dir : internal/librariangen
3140 - name : gcr.io/cloud-builders/docker
32- args :
41+ args :
3342 [
3443 " tag" ,
3544 " us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-$COMMIT_SHA" ,
45+ " us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-latest" ,
3646 ]
3747options :
3848 machineType : ' E2_HIGHCPU_8'
3949 requestedVerifyOption : VERIFIED # For provenance attestation generation
4050
4151images :
4252 - us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-$COMMIT_SHA
53+ - us-central1-docker.pkg.dev/cloud-sdk-production-pipeline/images-dev/librarian-go:infrastructure-public-image-latest
54+
Original file line number Diff line number Diff line change 1717
1818timeout : 7200s # 2 hours
1919steps :
20+ # Attempt to pull the latest image to use as a cache source.
21+ - name : gcr.io/cloud-builders/docker
22+ entrypoint : ' bash'
23+ args :
24+ - -c
25+ - |
26+ docker pull gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-latest || exit 0
2027 - name : gcr.io/cloud-builders/docker
2128 args :
2229 [
2330 " build" ,
31+ " --cache-from" ,
32+ " gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-latest" ,
2433 " -t" ,
2534 " gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-$COMMIT_SHA" ,
2635 " -f" ,
2938 ]
3039 dir : internal/librariangen
3140 - name : gcr.io/cloud-builders/docker
32- args :
41+ args :
3342 [
3443 " tag" ,
3544 " gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-$COMMIT_SHA" ,
@@ -41,3 +50,4 @@ options:
4150images :
4251 - gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-$COMMIT_SHA
4352 - gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-latest
53+
You can’t perform that action at this time.
0 commit comments