-
Notifications
You must be signed in to change notification settings - Fork 44
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
add Dockerfile and GitHub action for building image #63
base: main
Are you sure you want to change the base?
Conversation
5e15b1a
to
6ce2c3e
Compare
wow, 16 minutes to build the image for two platforms :( |
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.
Makes sense in general, I've left two suggestions.
I think ko would be faster than Docker build, but it seems like it is not possible to expose ports using ko ko-build/ko#472
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
# Sign the Docker image |
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.
Nice
Dockerfile
Outdated
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest && \ | ||
xcaddy build v${CADDY_VERSION} --with github.com/tailscale/caddy-tailscale@main --output /usr/bin/caddy |
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.
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest && \ | |
xcaddy build v${CADDY_VERSION} --with github.com/tailscale/caddy-tailscale@main --output /usr/bin/caddy | |
RUN go run github.com/caddyserver/xcaddy/cmd/xcaddy@latest build v${CADDY_VERSION} \ | |
--with github.com/tailscale/caddy-tailscale@main --output /usr/bin/caddy |
maybe makes it a little faster?
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.
Also, I'm wondering if we can use the tailscale-caddy
repo checkout available to this action rather than refer to github.com/tailscale/caddy-tailscale@main
? The checkout should presumably bet the one corresponding to the push event
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'd be surprised if go run
was actually any faster, but certainly doesn't hurt so let's give it a try.
And oops, totally forgot to instruct it to use the local source for building. I'll add that.
EXPOSE is really just to document what ports are exposed mapped, right? But it's not really necessary to be able to map ports? It also looks like ko really wants a simple main package that it can build. That would mean bypassing xcaddy entirely for our builds and having our own simple cmd. Which is totally fine, that's actually what I do for my personal website. I'll actually do that first as a separate PR. |
This largely mirrors the default Caddy image. Updates #14 Signed-off-by: Will Norris <[email protected]>
6ce2c3e
to
e33ea0f
Compare
We also have our own container builder that is a stripped down version of ko and that allows to include multiple binaries https://github.com/tailscale/mkctr. |
That is my understanding, yes. Also, we don't expose ports for any of the other images we build (for example the k8s-operator that runs a server and listens on 443 and the tsrecorder) |
This largely mirrors the default Caddy image. (I generally use chainguard images to limit dependencies, but stuck with alpine, since that's what Caddy uses for it's main images)
The GitHub Action is duplicated from what we have for
tailscale/golink
. I don't really know a lot of best practices for Dockerfiles, so am really looking for any input. I have this using thesimple.caddyfile
as the default config, which is easy to override.Updates #14