tailscale / caddy-tailscale

A highly experimental exploration of integrating Tailscale and Caddy.
Apache License 2.0
422 stars 44 forks source link

add Dockerfile and GitHub action for building image #63

Open willnorris opened 5 months ago

willnorris commented 5 months ago

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 the simple.caddyfile as the default config, which is easy to override.

Updates #14

willnorris commented 5 months ago

wow, 16 minutes to build the image for two platforms :(

willnorris commented 5 months ago

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

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.

irbekrm commented 5 months ago

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.

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. ~But I think we don't have an option to include static files with that~

irbekrm commented 5 months ago

EXPOSE is really just to document what ports are exposed mapped, right? But it's not really necessary to be able to map ports?

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)