Skip to content

Commit 8f07c5c

Browse files
Copilotpuehringer
andcommitted
Add env configuration support to config.json
Co-authored-by: puehringer <[email protected]>
1 parent 8ec48f1 commit 8f07c5c

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+
"env": {
44+
"type": "object",
45+
"description": "Environment variables to pass as build arguments 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
@@ -112,6 +112,10 @@ jobs:
112112
image_tag_branch_name: imageTagBranchName,
113113
ecr_respositories: flavor.components.map(component => component.ecr_repository),
114114
components: flavor.components.map(component => {
115+
// Format env variables as build-args string
116+
const envBuildArgs = component.env ?
117+
Object.entries(component.env).map(([key, value]) => `${key}=${value}`).join('\n') : '';
118+
115119
return {
116120
...component,
117121
// Add metadata to the component object (will be used as matrix input),
@@ -121,6 +125,7 @@ jobs:
121125
build_time: buildTime,
122126
image_tag: imageTag,
123127
image_tag_branch_name: imageTagBranchName,
128+
env_build_args: envBuildArgs,
124129
};
125130
}),
126131
};
@@ -221,6 +226,7 @@ jobs:
221226
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
222227
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
223228
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
229+
${{ matrix.component.env_build_args }}
224230
secrets:
225231
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
226232
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"

0 commit comments

Comments
 (0)