Skip to content
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

Is it possible to use typerefs as build args? #1155

Open
rudfoss-rr opened this issue Nov 1, 2024 · 0 comments
Open

Is it possible to use typerefs as build args? #1155

rudfoss-rr opened this issue Nov 1, 2024 · 0 comments

Comments

@rudfoss-rr
Copy link

I have several targets that build containers in my project and some depend on each other. I can use the tags option to specify that the containers will be tagged with the branch name which is great when building in a feature branch, but is there a way to use the same value in the build-args to tie multiple container images from the same branch together?

Something like this:

project.json:

{
	"executor": "@nx-tools/nx-container:build",
	"dependsOn": [
		{
			"projects": "@project/source",
			"target": "prebuild"
		}
	],
	"options": {
		"build-args": ["BASE_BUILD_TAG='type=ref,event=pr'"],
		"metadata": {
			"images": ["test-project"],
			"load": true,
			"tags": ["type=schedule", "type=ref,event=branch", "type=ref,event=tag", "type=ref,event=pr"]
		}
	}
}

Dockerfile:

ARG BASE_BUILD_TAG=latest
FROM base-build:$BASE_BUILD_TAG AS buildbase

Or am I going about this the wrong way maybe? I'm still relatively new to containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant