-
Notifications
You must be signed in to change notification settings - Fork 29
Blog: customizing the docker build bake hcl file #345
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
Conversation
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
…cl file Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Daniel. First post 🎉
There are a few corrections I've made and left as suggestions (highly suggested).
The blog post doesn't have much in the way of motivation and it simply finishes with the build command.
Maybe some narrative here would improve it. With this method, how is your flow easier? Have you been able to retire some old tooling? etc.
Also, please wrap text to 80 columns, as we generally do in CNPG documentation and website.
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
|
@jsilvela I see if I can wrap around some motivation text. regarding the 80col thing, so no line must be longen then 80 col's? |
|
It's not 100% strict. For example it's better not to mess with links. But most lines should not exceed 80 cols. |
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
jsilvela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Much better.
I've found some typos and some places where I think coherence was broken.
Left suggestions.
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
…ive-pg.github.io into my_baking_recepie Signed-off-by: Daniel Chambre <[email protected]>
jsilvela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few typos, the draft field, and also, do we need to change the package-lock file in this PR? Probably not, right?
Signed-off-by: Daniel Chambre <[email protected]>
jsilvela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
The draft status and date will need to be changed, aside from that ✔️
| variable "environment" { | ||
| default = "production" | ||
| } | ||
|
|
||
| variable "registry" { | ||
| default = "your.repo.url/cnpg" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need this since those variables are already defined in the parent bake file =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no sir, when I remove both the variables are
$ docker buildx bake -f docker-bake.hcl -f cwd://bake_bookworm.hcl "https://github.com/cloudnative-pg/postgres-containers.git" myimage --push --builder=container --list=variables
[+] Building 0.7s (2/2) FINISHED docker-container:container
=> CACHED [internal] load git source https://github.com/cloudnative-pg/postgres-containers.git 0.6s
=> [internal] load local bake definitions 0.0s
=> => reading bake_bookworm.hcl 3.15kB / 3.15kB 0.0s
VARIABLE TYPE VALUE DESCRIPTION
environment testing
registry localhost:5000
revision
with both in place
$ docker buildx bake -f docker-bake.hcl -f cwd://bake_bookworm.hcl "https://github.com/cloudnative-pg/postgres-containers.git" myimage --push --builder=container --list=variables
[+] Building 0.7s (2/2) FINISHED docker-container:container
=> CACHED [internal] load git source https://github.com/cloudnative-pg/postgres-containers.git 0.6s
=> [internal] load local bake definitions 0.0s
=> => reading bake_bookworm.hcl 3.15kB / 3.15kB 0.0s
VARIABLE TYPE VALUE DESCRIPTION
environment testing
registry XXX/cnpg
revision
so when I remove environmen and registry from my bake file, the image will be uploaded to localhost:5000 and the subdirectory will be postgresql-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can modify the value no need to define the variables again :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modify the value inside the hcl file?
I had a look at https://docs.docker.com/build/bake/overrides/ and that's how they override a variable inside an override file
variable "TAG" {
default = "bar"
}
I also have tried to set it like we did for platforms in the troubleshooting session
platforms = [
"linux/amd64",
]
environment = [
"production",
]
registry = [
"xxx/cnpg",
]
but that's not working eighter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: Floor Drees <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]> Signed-off-by: smiyc <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
|
For me this post could have been published a while ago. Given it three approvals. |
Signed-off-by: Floor Drees <[email protected]>
Signed-off-by: Daniel Chambre <[email protected]> Signed-off-by: smiyc <[email protected]> Signed-off-by: Floor Drees <[email protected]> Signed-off-by: Jaime Silvela <[email protected]> Co-authored-by: Jaime Silvela <[email protected]> Co-authored-by: Floor Drees <[email protected]> 5e8bb5b
Signed-off-by: Daniel Chambre <[email protected]> Signed-off-by: smiyc <[email protected]> Signed-off-by: Floor Drees <[email protected]> Signed-off-by: Jaime Silvela <[email protected]> Co-authored-by: Jaime Silvela <[email protected]> Co-authored-by: Floor Drees <[email protected]> Signed-off-by: Harshil <[email protected]>
blog about how I used Jonathan's blog post to create an override hcl.
Signed-off-by: Daniel Chambre [email protected]