Docker Image for caddy server with all the addons

I’ve created a docker image with all the caddy addons. Hope this helps some one. I’ll try and add examples of using it.
vanthiyathevan/caddy-server

It is small (47MB, or 18MB compressed).

PS: I am not 100% sure that this belong to this category.

4 Likes

This belongs in the Production Use category.

Also, you can’t call it “Minimal” and then include all the addons… :stuck_out_tongue:

Haha Thanks.
Minimal in terms of the docker image size. The addons don’t add a lot to the size. The size will go do significantly if I don’t include git package and git addon

Caddy is a great webserver and I would love to use it as reverse proxy for docker (auto config, lets encrypt) too :slight_smile:

File sizes are relative! Sure, relative to my 256GB USB drive it’s teeny, but relative to the size it would be otherwise, without those addons, it’s pretty huge.

Minimal implies “this is the very least required for this to work”, so calling a deliberately bloated docker image minimal is rather disingenuous IMO.

I don’t think it matters…

Thanks for making this @Suntharesan_Mohan - hopefully in the future we have some tooling to help people manage this on their own so you won’t have to maintain it. :slight_smile:

1 Like

You can use it as a reverse proxy with docker and caddy. I’ve been using it in production for a while using docker-compose.

Example of that is
docker-compose.yaml

version: "2"
volumes:
  caddy-tls-certs:
    driver: local
services:
  node1:
    restart: always
    image: custom-node-app:latest
    container_name: app-node1
    ports: 
      - "4000"
  node2:
    restart: always
    container_name: app-node2
    extends:
      service: node1
  caddy:
    restart: always
    image: vanthiyathevan/caddy-server:latest
    container_name: app-caddy
    depends_on: [node1]
    ports: 
      - "80:80"
      - "443:443"
      - "9180:9180"
    volumes:
      - ./Caddyfile:/etc/Caddyfile
      - caddy-tls-certs:/root/.caddy:rw
    volumes_from:
      - node1:ro

And my Caddyfile

dashboard.mydomain.com { # Can't expose the domain yet
  prometheus :9180 # Monitoring
  gzip
  tls
  header / {
    -Server
  }
  proxy / node1:4000 node2:4000 {
    proxy_header Host {host}
    proxy_header X-Real-IP {remote}
    proxy_header X-Forwarded-Proto {scheme}
    websocket
    except /css /fonts /js /img
  }
  root /node-app/public
  log stdout
  errors stderr
}

You’re right, I’m probably being a pedant. Didn’t mean to rain on anybody’s parade, of course!

Given that minimal means different things to different people :smile: I’ve removed it.

@matt Thanks. wget getcaddy.com | bash makes it really easy to do this though.

1 Like

I put this together as a test, it builds a docker image with specified plugins.

curl https://get.gogit.io/caddy | bash -s git,hugo

Maybe something like this could be on https://getcaddy.com/docker ?

Edit: Updated the script to use the much better Dockerfile by @Suntharesan_Mohan

1 Like

We could add more endpoints to the getcaddy site, as long as they can be officially maintained/supported for the long-term and if it serves a wide, general audience.

Building the docker image is very similar to how Discourse distributes their docker container, so I think it would serve a general audience.
Should we take a poll or something?

Sure, feel free to do a poll. The volume here is pretty low but it’s a start!