Compare commits

...

16 commits

Author SHA1 Message Date
jreichmann 85bca47cba Documentation outdated (#2)
Some checks failed
the build failed
2018-12-05 22:22:50 +00:00
Jan Christian Grünhage 6de73756d6 chore: add s6 svscan finish file
All checks were successful
the build was successful
2018-08-09 08:19:47 +02:00
Jan Christian Grünhage 21b38bada3 chore: add newer versions to build 2018-08-09 08:18:03 +02:00
Jan Christian Grünhage 0fb9fc8c60 fix: add ca-certificates, so that requesting certificates doesn't fail 2018-08-09 08:18:03 +02:00
Jan Christian Grünhage 484ee2c740 chore: forgot to pull, need to merge 2018-08-09 08:17:52 +02:00
Jan Christian Grünhage 7431af5d95 chore: move Caddyfile from /etc to /etc/caddy
All checks were successful
the build was successful
move Caddyfile, so that it can be in a volume.
when using volumes and not bind mounts one can not simply mount a whole directory,
after this change mounting /etc/caddy works as intended
2018-02-19 16:44:07 +01:00
Jan Christian Grünhage 36fcd5172d fix: install bash, run script requires it:>
All checks were successful
the build was successful
2018-02-15 13:08:12 +01:00
Jan Christian Grünhage e3b5864f34
move most of this image over to docker.jcg.re/base-caddy, to make it integratable
All checks were successful
the build was successful
2018-01-27 21:24:09 +01:00
Jan Christian Grünhage a441803975
docs: fix missing newline causing wrong indention 2017-12-16 11:33:48 +01:00
Jan Christian Grünhage 1e23a2a6df
docs: add documentation
All checks were successful
the build was successful
2017-12-16 11:32:09 +01:00
Jan Christian Grünhage 6cd8a76803
chore: removed version v0.10.4, as that one is not compatible with forwardproxy
All checks were successful
the build was successful
2017-12-15 04:30:41 +01:00
Jan Christian Grünhage 2dcb90d1b5
fix: fix CI building latest tag multiple times
Some checks failed
the build failed
2017-12-15 03:56:36 +01:00
Jan Christian Grünhage 0830895f9c
feat: add version builds
Some checks failed
the build failed
2017-12-15 03:52:25 +01:00
Jan Christian Grünhage d4d2f19b18
feat: add more granular configuration via env vars 2017-12-15 03:35:21 +01:00
Jan Christian Grünhage 84a0a03ac6
chore: update caddy and move base image, add ci
All checks were successful
the build was successful
2017-12-09 11:31:32 +01:00
Jan Christian Grünhage ecb6aa83a5 update caddy 2017-09-04 18:41:05 +02:00
8 changed files with 159 additions and 42 deletions

32
.drone.yml Normal file
View file

@ -0,0 +1,32 @@
pipeline:
docker:
image: plugins/docker
repo: docker.jcg.re/caddy
build_args:
- BRANCH=tags/${CADDY_VERSION}
registry: docker.jcg.re
secrets: [ docker_username, docker_password ]
tags: ${CADDY_VERSION}
docker:
image: plugins/docker
repo: docker.jcg.re/caddy
registry: docker.jcg.re
secrets: [docker_username, docker_password ]
tags: latest
when:
matrix:
CADDY_VERSION: v0.11.0
matrix:
CADDY_VERSION:
- v0.11.0
- v0.10.14
- v0.10.12
- v0.10.11
- v0.10.10
- v0.10.9
- v0.10.8
- v0.10.7
- v0.10.6
- v0.10.5

51
Dockerfile Executable file → Normal file
View file

@ -1,39 +1,12 @@
FROM jcgruenhage/baseimage-alpine
MAINTAINER Jan Christian Grünhage <jan.christian@gruenhage.xyz>
ENV GOPATH=/gopath \
CADDY_REPO_OWNER=mholt \
CADDY_REPO_NAME=caddy \
CADDY_BRANCH=tags/v0.10.4 \
CADDYPATH=/caddy \
UID=192 \
GID=192
ADD plugins.txt /plugins
RUN apk upgrade --update \
&& apk add build-base su-exec libcap go git \
&& mkdir -p $GOPATH/src/github.com/$CADDY_REPO_OWNER \
&& cd $GOPATH/src/github.com/$CADDY_REPO_OWNER \
&& git clone https://github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME \
&& cd $CADDY_REPO_NAME \
&& git checkout $CADDY_BRANCH \
&& cd caddy/caddymain \
&& export line="$(grep -n "// This is where other plugins get plugged in (imported)" < run.go | sed 's/^\([0-9]\+\):.*$/\1/')" \
&& head -n ${line} run.go > newrun.go \
&& cat /plugins >> newrun.go \
&& line=`expr $line + 1` \
&& tail -n +${line} run.go >> newrun.go \
&& rm -f run.go \
&& mv newrun.go run.go \
&& go get github.com/$CADDY_REPO_OWNER/$CADDY_REPO_NAME/... \
&& mv $GOPATH/bin/caddy /usr/bin \
&& setcap cap_net_bind_service=+ep /usr/bin/caddy \
&& apk del --purge build-base go \
&& mkdir $CADDYPATH \
&& rm -rf $GOPATH /var/cache/apk/* /plugins
ADD root /
EXPOSE 2015 80 443
VOLUME ["$CADDYPATH"]
FROM docker.io/matrixdotorg/base-caddy
ENV UID=1337 \
GID=1337
RUN apk add --no-cache \
su-exec \
s6 \
ca-certificates \
bash
ADD root /
EXPOSE 2015 80 443
VOLUME ["/etc/caddy", "/var/www"]
CMD ["/bin/s6-svscan", "/etc/s6.d/"]

81
README.md Normal file
View file

@ -0,0 +1,81 @@
## docker.jcg.re/caddy
[![Build Status](https://drone.jcg.re/api/badges/jcgruenhage/docker-caddy/status.svg)](https://drone.jcg.re/jcgruenhage/docker-caddy)
#### Tags:
- **latest**: latest stable version (currently 0.10.10)
- **v0.10.10**: v0.10.10 of caddy
- **v0.10.9**: v0.10.9 of caddy
- **v0.10.8**: v0.10.8 of caddy
- **v0.10.7**: v0.10.7 of caddy
- **v0.10.6**: v0.10.6 of caddy
- **v0.10.5**: v0.10.5 of caddy
- **v0.10.4**: v0.10.4 of caddy
#### Build-time variables
- **CLONE_URL**: From where to clone caddy (default: https://github.com/mholt/caddy.git)
- **BRANCH**: Which branch to use. (default: `latest stable tag)
#### Environment variables
- **UID**: user id (default: 192)
- **GID**: group id (default: 192)
- **DOMAIN**: the domain that should be served (required for automatic tls)
- **EMAIL**: the email address to use for let's encrypt (required for automatic tls)
- **USE_QUIC**: set this to anything to enable experimental quic support (default: off)
- **LE_STAGING**: use staging let's encrypt endpoint (default: off -> production)
#### Volumes
- **/etc/caddy/Caddyfile**: webserver configuration (optional)
- **/var/www/**: content to serve
- **/caddy**: caddy will store it's certificates here (recommended if tls is active)
#### Ports
- 80
- 443
#### Basic docker-compose.yml example
Insecure example serving the contents of `./website`on port 80:
```yaml
version: '2'
services:
caddy:
image: docker.jcg.re/caddy
container_name: caddy
ports:
- 80:80
volumes:
- ./website:/var/www/
```
Secure example serving the contents of `./website`on https://example.com/ with an automatic redirect to https:
```yaml
version: '2'
services:
caddy:
image: docker.jcg.re/caddy
container_name: caddy
ports:
- 80:80
- 443:443
volumes:
- ./website:/var/www/
environment:
- DOMAIN=example.com
- EMAIL=you@example.com
```
Custom example doing whatever-the-fuck-you-want (take a look at https://caddyserver.com/docs):
```yaml
version: '2'
services:
caddy:
image: docker.jcg.re/caddy
container_name: caddy
ports:
- 80:80
- 443:443
volumes:
- ./website:/var/www
- ./Caddyfile:/etc/Caddyfile
```

View file

@ -1 +1,4 @@
_ "github.com/abiosoft/caddy-git"
_ "github.com/caddyserver/forwardproxy"
_ "github.com/zikes/gopkg"
_ "github.com/miekg/caddy-prometheus"

View file

@ -0,0 +1,3 @@
:80 {
root /var/www
}

View file

@ -0,0 +1,4 @@
DOMAIN {
root /var/www
tls EMAIL
}

View file

@ -0,0 +1 @@
#!/bin/sh

View file

@ -1,3 +1,23 @@
#!/bin/sh
chown -R ${UID}:${GID} /caddy
exec su-exec ${UID}:${GID} /usr/bin/caddy -quic --conf /caddy/Caddyfile
#!/bin/bash
if [[ -z ${CADDYPATH} ]]; then
export CADDYPATH=/etc/caddy
fi
P="--conf ${CADDYPATH}/Caddyfile"
if [[ -n ${USE_QUIC} ]]; then
P="-quic $P"
fi
if [[ -n ${LE_STAGING} ]]; then
P="-ca acme-staging.api.letsencrypt.org/directory $P"
fi
chown -R ${UID}:${GID} /var/www
chown -R ${UID}:${GID} ${CADDYPATH}
if [[ ! -f ${CADDYPATH}/Caddyfile ]]; then
if [[ -z "$DOMAIN" || -z "$EMAIL" ]]; then
cp /etc/Caddyfile.insecure.template ${CADDYPATH}/Caddyfile
else
cp /etc/Caddyfile.secure.template ${CADDYPATH}/Caddyfile
sed -i -e "s/DOMAIN/${DOMAIN}/" -e "s/EMAIL/${EMAIL}/" ${CADDYPATH}/Caddyfile
fi
fi
cd ${CADDYPATH}
su-exec ${UID}:${GID} /usr/bin/caddy $P