Skip to content

Commit c12a89b

Browse files
authored
build: create dispatcher docker image that prefetches and prebuilds (#2151)
Towards #2142 After publishing, we will need to update the cloudbuild.yaml files to use the dispatcher image instead of the golang base image.
1 parent 7ad48e6 commit c12a89b

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2025 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+
# This Cloud Build configuration is used by a Louhi flow for the Artifact
15+
# Registry (AR) Exit Gate process (go/cloud-sdk-ar-exit-gate-onboarding).
16+
#
17+
# This build step creates the librarian container image and publishes it to the
18+
# 'images-dev' repository, which serves as the entry point for the AR Exit Gate.
19+
# After passing the gate's security checks, the image is promoted and
20+
# published to the 'images-prod' repository.
21+
steps:
22+
- id: build-dispatcher
23+
name: 'gcr.io/cloud-builders/docker'
24+
waitFor: ['-']
25+
args:
26+
- 'build'
27+
- '-t'
28+
- 'us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-dev/librarian-dispatcher'
29+
- '.'
30+
- '-f'
31+
- 'infra/dispatcher/Dockerfile'
32+
images:
33+
- 'us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-dev/librarian-dispatcher'

cloudbuild-test.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
# Local test:
2323
# gcloud --project=<my-project> builds submit . --config=cloudbuild-test.yaml
2424
steps:
25-
- name: 'gcr.io/cloud-builders/docker'
25+
- id: 'build'
26+
name: 'gcr.io/cloud-builders/docker'
2627
waitFor: ['-']
2728
args:
2829
- 'build'
@@ -31,9 +32,20 @@ steps:
3132
- '.'
3233
- id: structure-test
3334
name: gcr.io/gcp-runtimes/structure_test
35+
waitFor: ['build']
3436
args:
3537
- '-i'
3638
- 'us-central1-docker.pkg.dev/$PROJECT_ID/librarian'
3739
- '--config'
3840
- '/workspace/container-structure-test.yaml'
3941
- '-v'
42+
- id: 'build-dispatcher'
43+
name: 'gcr.io/cloud-builders/docker'
44+
waitFor: ['-']
45+
args:
46+
- 'build'
47+
- '-t'
48+
- 'us-central1-docker.pkg.dev/$PROJECT_ID/librarian-dispatcher'
49+
- '.'
50+
- '-f'
51+
- 'infra/dispatcher/Dockerfile'

infra/dispatcher/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 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+
FROM golang:1.25.0
15+
16+
WORKDIR /app
17+
18+
ADD . /app
19+
RUN go build ./...
20+
21+
ENTRYPOINT [ "go" ]

0 commit comments

Comments
 (0)