Skip to content

Commit a4b8397

Browse files
Copilotpuehringer
andauthored
Allow build_args configuration in config.json for Docker builds (#203)
* Initial plan * Add env configuration support to config.json Co-authored-by: puehringer <[email protected]> * Clean up formatting and finalize env configuration feature Co-authored-by: puehringer <[email protected]> * Rename 'env' to 'build_args' for better semantic accuracy Co-authored-by: puehringer <[email protected]> * Update .gitignore --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: puehringer <[email protected]>
1 parent 5f61b2d commit a4b8397

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.github/workflows/build-docker-artifacts-config.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
"type": "boolean",
4040
"default": true,
4141
"description": "Scan the image for high severity vulnerabilities"
42+
},
43+
"build_args": {
44+
"type": "object",
45+
"description": "Build arguments to pass to Docker",
46+
"additionalProperties": {
47+
"type": "string"
48+
}
4249
}
4350
},
4451
"required": ["directory", "ecr_repository"]

.github/workflows/build-docker-artifacts.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ jobs:
114114
image_tag_branch_name: imageTagBranchName,
115115
ecr_respositories: flavor.components.map(component => component.ecr_repository),
116116
components: flavor.components.map(component => {
117+
// Format build arguments as build-args string
118+
const formattedBuildArgs = component.build_args ?
119+
Object.entries(component.build_args).map(([key, value]) => `${key}=${value}`).join('\n') : '';
120+
117121
return {
118122
...component,
119123
// Add metadata to the component object (will be used as matrix input),
@@ -123,6 +127,7 @@ jobs:
123127
build_time: buildTime,
124128
image_tag: imageTag,
125129
image_tag_branch_name: imageTagBranchName,
130+
formatted_build_args: formattedBuildArgs,
126131
};
127132
}),
128133
};
@@ -223,6 +228,7 @@ jobs:
223228
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
224229
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
225230
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
231+
${{ matrix.component.formatted_build_args }}
226232
secrets:
227233
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
228234
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"

0 commit comments

Comments
 (0)