Docker instructions and configuration (#33)

* Added dockerfile

* Docker configuration

* Added Docker images, composer configuration and documentation
This commit is contained in:
Joona Hoikkala 2018-01-22 12:35:07 +02:00 committed by GitHub
parent c5337fc841
commit 665455d319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 3 deletions

20
Dockerfile Normal file
View File

@ -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

View File

@ -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

View File

@ -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"

14
docker-compose.yml Normal file
View File

@ -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