Skip to content

chore: demo of using ARG with Dockerfiles #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ steps:
"build",
"--no-cache",
"-t", "${_TEST_IMAGE}",
"-f", ".cloudbuild/library_generation/library_generation_airlock.Dockerfile",
# 3.9.9-eclipse-temurin-11-alpine
"--build-arg", "GGJ_BUILD_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/maven@sha256:d3f04985c6a68415e36c0a6468d0f8316f27d4dbee77bc459257ba444224bd9f",
# 3.12.3-slim-bookworm
"--build-arg", "FINAL_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/python@sha256:afc139a0a640942491ec481ad8dda10f2c5b753f5c969393b12480155fe15a63",
"-f", ".cloudbuild/library_generation/library_generation.Dockerfile",
"."
]
id: build-image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ steps:
"build",
"-t", "${_SHA_IMAGE_ID}",
"-t", "${_VERSIONED_IMAGE_ID}",
"-f", ".cloudbuild/library_generation/library_generation_airlock.Dockerfile",
# 3.9.9-eclipse-temurin-11-alpine
"--build-arg", "GGJ_BUILD_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/maven@sha256:d3f04985c6a68415e36c0a6468d0f8316f27d4dbee77bc459257ba444224bd9f",
# 3.12.3-slim-bookworm
"--build-arg", "FINAL_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/python@sha256:afc139a0a640942491ec481ad8dda10f2c5b753f5c969393b12480155fe15a63",
"-f", ".cloudbuild/library_generation/library_generation.Dockerfile",
"."
]
id: library-generation-build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ steps:
"-t", "${_PUBLIC_SHA_IMAGE_ID}",
"-t", "${_PUBLIC_LATEST_IMAGE_ID}",
"-t", "${_PUBLIC_VERSIONED_IMAGE_ID}",
"-f", ".cloudbuild/library_generation/library_generation_airlock.Dockerfile",
# 3.9.9-eclipse-temurin-11-alpine
"--build-arg", "GGJ_BUILD_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/maven@sha256:d3f04985c6a68415e36c0a6468d0f8316f27d4dbee77bc459257ba444224bd9f",
# 3.12.3-slim-bookworm
"--build-arg", "FINAL_BASE=us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/python@sha256:afc139a0a640942491ec481ad8dda10f2c5b753f5c969393b12480155fe15a63",
"-f", ".cloudbuild/library_generation/library_generation.Dockerfile",
"."
]
id: library-generation-build
Expand Down
6 changes: 4 additions & 2 deletions .cloudbuild/library_generation/library_generation.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
# install gapic-generator-java in a separate layer so we don't overload the image
# with the transferred source code and jars

ARG GGJ_BUILD_BASE="docker.io/library/maven:3.9.9-eclipse-temurin-17-alpine@sha256:969014ee8852c9910ff5ef09de17541c2587819364b79d7dc044634dfb8a3388"
ARG FINAL_BASE="docker.io/library/python:3.13.2-slim@sha256:6b3223eb4d93718828223966ad316909c39813dee3ee9395204940500792b740"

FROM docker.io/library/maven:3.9.9-eclipse-temurin-17-alpine@sha256:969014ee8852c9910ff5ef09de17541c2587819364b79d7dc044634dfb8a3388 AS ggj-build
FROM $GGJ_BUILD_BASE AS ggj-build

WORKDIR /sdk-platform-java
COPY . .
Expand All @@ -34,7 +36,7 @@ RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
RUN cp "/root/.m2/repository/com/google/api/gapic-generator-java/${DOCKER_GAPIC_GENERATOR_VERSION}/gapic-generator-java-${DOCKER_GAPIC_GENERATOR_VERSION}.jar" \
"./gapic-generator-java.jar"

FROM docker.io/library/python:3.13.2-slim@sha256:6b3223eb4d93718828223966ad316909c39813dee3ee9395204940500792b740 as final
FROM $FINAL_BASE as final

ARG OWLBOT_CLI_COMMITTISH=3a68a9c0de318784b3aefadcc502a6521b3f1bc5
ARG PROTOC_VERSION=25.8
Expand Down
113 changes: 0 additions & 113 deletions .cloudbuild/library_generation/library_generation_airlock.Dockerfile

This file was deleted.

Loading