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

Build docker images with ko (goreleaser) #1716

Merged
merged 7 commits into from
Feb 12, 2024

Conversation

kradalby
Copy link
Collaborator

@kradalby kradalby commented Feb 3, 2024

Move away from the complicated docker release setup and use ko within goreleaser.

Copy link
Collaborator

@ohdearaugustin ohdearaugustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I think this is a good idea. We should just discuss one or two things I mentioned in the review to make sure we don't break stuff.

.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
@@ -1,30 +0,0 @@
# Builder image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the move to kos, which makes things way easier.

I just want to make aware of one drawback. Users can't build the dockercontainers by themselves anymore. Manual builds for testing use then a different container than the released ones. For testing in the pipeline we would use docker.io/golang:1.21-bookworm as basic and the kos settings would use gcr.io/distroless/base-debian11.

This just reminds me of the discussion that distroless containers are to "complicated" to maintain.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, for the time being, I am willing to give the distroless part another chance, and then keep the Dockerfile.debug around for "build your own".

I'm not sure if we can make the goreleaser push containers if there is no release, but that would be useful.

Goreleaser supports a docker mode which is more traditional, but it requires more stuff, I would prefer to try ko first and then potentially switch to that if its not working out.

This just reminds me of the discussion that distroless containers are to "complicated" to maintain.
I appreciate this comment ;), luckily I've right now forgotten all the pain points and will try this and then curse in the future.

let me know what you think.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can try it of course.

I would also add the debug image of distroless, as a lot of people use stuff like portainer and so and they normally want to have a shell inside the container. This is the same we did before we got rid of the old distroless containers. Furthermore the question is if ko can create our folders inside the container. As we had the problem beforehand: #1417

So a bit of a general blueprint:

  1. Container with distroless-debian12
  2. Container with distroless-debian12:debug

I guess testing the whole thing on a fork with "fake releases" would be our best option to get this thing working and tested before merging into main.

I hope I didn't reminded you of too much pain, because I'm still a huge fan of distroless images.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehehe, no worries, I've added debug but based on regular debian image as a compromise for now. Would you have time to help me test it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or could merge it and test it as part of the next alpha.

kradalby and others added 7 commits February 12, 2024 09:15
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add in the comment that we generate the official container using goreleaser ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do that after testing this.

@kradalby kradalby merged commit 0333e97 into juanfont:main Feb 12, 2024
50 of 51 checks passed
@paralin
Copy link

paralin commented Feb 13, 2024

How do we build headscale/headscale now after this change?

@ohdearaugustin
Copy link
Collaborator

The idea is that then there is just a debug dockerfile and the containers are only released by goreleaser. So no dockerfiles for released container anymore.

@paralin
Copy link

paralin commented Feb 13, 2024

But I'd like to build it myself, how can I do that?

@ohdearaugustin
Copy link
Collaborator

ohdearaugustin commented Feb 13, 2024

As said with the debug dockerfile or you bring your own.

Edit: Or you fork it and release your own version.

@paralin
Copy link

paralin commented Feb 13, 2024

Okay, I was looking for something like "goreleaser build" or "ko build" or similar. Will figure it out

@ohdearaugustin
Copy link
Collaborator

Yeah goreleaser doesn't support that. Docu about the build process can be found here. You probably can get the configuration out of the .goreleaser.yml, edit it a bit and then try to build it with kos standalone.

But this is still work in progress. So we will see how it will turn out.

@sevenrats
Copy link

this has a negative impact on the apparent trustworthiness of headscale. I'm further from being able to reproduce your build, the images themselves look very suspect because the build commands are all blank on dockerhub. Looking at the included dockerfile its not immediately apparent what complexity is being resolved by this switch. Why make these sacrifices? What do you gain by moving to ko? ntm that it seems really odd to use docker to ship a service which contains a cli interface but no cli. am I really supposed to docker exec headscale headscale literally every single command?

@kradalby
Copy link
Collaborator Author

kradalby commented Nov 1, 2024

Docker isn’t a priority and we release them as a nice to have, considering Headscale is a single binary it isn’t really necessary.

The switch was made to simplify our build and lessen the burden on maintainers, which it did so it’s been a success and it’s easier for us to reason about

@sevenrats
Copy link

whether or not a service is a single binary is not really a factor in whether or not people reach for a dockerized solution. its just the nature of their stack that dictates it typically, and with over 500k downloads on your official image I think there is an onus to deliver the docker image well and in a standard way.
I would be willing to help shoulder some of the burden of delivering more standard docker containers if there is a way.

@sevenrats sevenrats mentioned this pull request Nov 1, 2024
6 tasks
@kradalby
Copy link
Collaborator Author

kradalby commented Nov 1, 2024

Sorry we are not interested in changing it

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

Successfully merging this pull request may close these issues.

5 participants