diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..227e9777a4c40c5277473574ed5cbd4ff18c39b2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.9.2-alpine AS builder +LABEL maintainer="joona@kuori.org" + +RUN apk add --update gcc musl-dev git + +RUN go get github.com/joohoi/acme-dns +WORKDIR /go/src/github.com/joohoi/acme-dns +RUN CGO_ENABLED=1 go build + +FROM alpine:latest + +WORKDIR /root/ +COPY --from=builder /go/src/github.com/joohoi/acme-dns . +RUN mkdir -p /etc/acme-dns +RUN mkdir -p /var/lib/acme-dns +RUN rm -rf ./config.cfg + +VOLUME ["/etc/acme-dns", "/var/lib/acme-dns"] +ENTRYPOINT ["./acme-dns"] +EXPOSE 53 80 443 diff --git a/README.md b/README.md index f0f460eb880ff2eca492aba99fb2609d2ec66f30..41070e8b149ad4c738f694e0f34e0ec0fe51c35d 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,35 @@ Check out how in the INSTALL section. 5) Run acme-dns. Please note that acme-dns needs to open a privileged port (53, domain), so it needs to be run with elevated privileges. +## Using Docker + +1) Pull the latest acme-dns Docker image: `docker pull joohoi/acme-dns` + +2) Create directories: `config` for the configuration file, and `data` for the sqlite3 database. + +3) Copy [configuration template](https://raw.githubusercontent.com/joohoi/acme-dns/master/config.cfg) to `config/config.cfg` + +4) Modify the config.cfg to suit your needs. + +5) Run Docker, this example expects that you have `port = "80"` in your config.cfg: +``` +docker run --rm --name acmedns \ + -p 53:53 \ + -p 80:80 \ + -v /path/to/your/config:/etc/acme-dns:ro \ + -v /path/to/your/data:/var/lib/acme-dns \ + -d joohoi/acme-dns +``` + +## Docker Compose + +1) Create directories: `config` for the configuration file, and `data` for the sqlite3 database. + +2) Copy [configuration template](https://raw.githubusercontent.com/joohoi/acme-dns/master/config.cfg) to `config/config.cfg` + +3) Copy [docker-compose.yml from the project](https://raw.githubusercontent.com/joohoi/acme-dns/master/docker-compose.yml), or create your own. + +4) Edit the `config/config.cfg` and `docker-compose.yml` to suit your needs, and run `docker-compose up -d` ## Configuration diff --git a/config.cfg b/config.cfg index 77cd3f0391790a3505dbd0c4fbca3754c75b409e..127daeeaa630f71abdaf688e593603eec7aaa2e7 100644 --- a/config.cfg +++ b/config.cfg @@ -27,7 +27,8 @@ debug = false # Database engine to use, sqlite3 or postgres engine = "sqlite3" # Connection string, filename for sqlite3 and postgres://$username:$password@$host/$db_name for postgres -connection = "acme-dns.db" +# Please note that the default Docker image uses path /var/lib/acme-dns/acme-dns.db for sqlite3 +connection = "/var/lib/acme-dns/acme-dns.db" # connection = "postgres://user:password@localhost/acmedns_db" [api] @@ -36,9 +37,9 @@ api_domain = "" # email to use for account registration for Let's Encrypt, used only if tls = "letsencrypt" le_email = "admin@example.com" # listen ip eg. 127.0.0.1 -ip = "127.0.0.1" +ip = "0.0.0.0" # listen port, eg. 443 for default HTTPS -port = "8080" +port = "80" # possible values: "letsencrypt", "cert", "none" tls = "none" # only used if tls = "cert" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..2c9ceeaab2349aa89d9fe06d93b677c51ba1c436 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '2' +services: + acmedns: + build: + context: . + dockerfile: Dockerfile + image: joohoi/acme-dns:latest + ports: + - "443:443" + - "53:53" + - "80:80" + volumes: + - ./config:/etc/acme-dns:ro + - ./data:/var/lib/acme-dns