Skip to content

Commit 76b45a0

Browse files
authored
fix: Build Docker contains using gcloud for releases (#2306)
1 parent 7be0cd1 commit 76b45a0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

docs/releasing/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ This document walks through the process of creating a new release of Online Bout
1414

1515
- `TAG` - This is the new version (e.g., `v0.3.5`).
1616
- `REPO_PREFIX` - This is the Docker repository.
17+
- `PROJECT_ID` - This is the Google Cloud project in which Google Cloud Build will be used to remotely build microservice Docker images.
1718

1819
**Example:**
19-
20+
2021
```
2122
export TAG=v0.3.5
2223
export REPO_PREFIX=gcr.io/google-samples/microservices-demo
24+
export PROJECT_ID=google-samples
2325
```
2426

2527
5. Run `./docs/releasing/make-release.sh`.

docs/releasing/make-docker-images.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ log() { echo "$1" >&2; }
2424

2525
TAG="${TAG:?TAG env variable must be specified}"
2626
REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}"
27+
PROJECT_ID="${PROJECT_ID:?PROJECT_ID env variable must be specified e.g. google-samples}"
2728

2829
while IFS= read -d $'\0' -r dir; do
2930
# build image
@@ -37,11 +38,8 @@ while IFS= read -d $'\0' -r dir; do
3738
image="${REPO_PREFIX}/$svcname:$TAG"
3839
(
3940
cd "${builddir}"
40-
log "Building: ${image}"
41-
docker build --pull -t "${image}" .
42-
43-
log "Pushing: ${image}"
44-
docker push "${image}"
41+
log "Building (and pushing) image on Google Cloud Build: ${image}"
42+
gcloud builds submit --project=${PROJECT_ID} --tag=${image}
4543
)
4644
done < <(find "${REPO_ROOT}/src" -mindepth 1 -maxdepth 1 -type d -print0)
4745

docs/releasing/make-release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fail() { log "$1"; exit 1; }
3030

3131
TAG="${TAG:?TAG env variable must be specified}"
3232
REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified e.g. gcr.io\/google-samples\/microservices-demo}"
33+
PROJECT_ID="${PROJECT_ID:?PROJECT_ID env variable must be specified e.g. google-samples}"
3334

3435
if [[ "$TAG" != v* ]]; then
3536
fail "\$TAG must start with 'v', e.g. v0.1.0 (got: $TAG)"

0 commit comments

Comments
 (0)