Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

wemake-services/caddy-docker

Repository files navigation

caddy

Deprecated: use official image instead

wemake.services Build Status Dockerhub image size caddy's version

Caddy

A docker image for Caddy.

License

This image uses a release from github, so it is a subject to the project's Apache 2.0 license and not to the EULA license.

You can use it for almost everything. This project is licensed under MIT. See LICENSE.md for details.

Running

docker run -p 2015:2015 wemakeservices/caddy-docker

docker-compose example

This image is created to be used in docker-compose.yml. Here's an example:

version: '3'
services:
  caddy:
    image: "wemakeservices/caddy-docker:latest"
    volumes:
      - ./some/path:/root/.caddy  # to save certificates on disk
      - ./some/Caddyfile:/etc/Caddyfile  # to mount custom Caddyfile
    ports:
      - "2015:2015"
      - "80:80"
      - "443:443"
    depends_on:
      - web

  web:
    build: .
    command: python manage.py runserver 0.0.0.0:5000
    ports:
      - "5000:5000"

Changing default Caddyfile

Just specify another Caddyfile via command line:

docker run -p 2015:2015 -v `pwd`/test/Caddyfile:/etc/Caddyfile wemakeservices/caddy-docker

Backing-up certificates

Let's Encrypt has rate limits. It is wise to reuse certificates and back them up:

docker run -p 2015:2015 -v `pwd`/backup:/root/.caddy wemakeservices/caddy-docker

It is also possible to combine this trick with Changing default Caddyfile.

Changing Caddy's version

This image supports VERSION build-time argument:

docker build --build-arg VERSION=0.10.0 -t caddy:0.10.0 .

See also

  • Automated Caddy reverse proxy for docker containers: caddy-gen

Developing

If you are building a container from source, you will need to build it as follows:

docker build -t caddy:latest .

And then run it locally:

docker run -p 2015:2015 caddy:latest