Skip to content

Commit 665455d

Browse files
authored
Docker instructions and configuration (joohoi#33)
* Added dockerfile * Docker configuration * Added Docker images, composer configuration and documentation
1 parent c5337fc commit 665455d

File tree

4 files changed

+67
-3
lines changed

4 files changed

+67
-3
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM golang:1.9.2-alpine AS builder
2+
LABEL maintainer="[email protected]"
3+
4+
RUN apk add --update gcc musl-dev git
5+
6+
RUN go get github.com/joohoi/acme-dns
7+
WORKDIR /go/src/github.com/joohoi/acme-dns
8+
RUN CGO_ENABLED=1 go build
9+
10+
FROM alpine:latest
11+
12+
WORKDIR /root/
13+
COPY --from=builder /go/src/github.com/joohoi/acme-dns .
14+
RUN mkdir -p /etc/acme-dns
15+
RUN mkdir -p /var/lib/acme-dns
16+
RUN rm -rf ./config.cfg
17+
18+
VOLUME ["/etc/acme-dns", "/var/lib/acme-dns"]
19+
ENTRYPOINT ["./acme-dns"]
20+
EXPOSE 53 80 443

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,35 @@ Check out how in the INSTALL section.
117117

118118
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.
119119

120+
## Using Docker
121+
122+
1) Pull the latest acme-dns Docker image: `docker pull joohoi/acme-dns`
123+
124+
2) Create directories: `config` for the configuration file, and `data` for the sqlite3 database.
125+
126+
3) Copy [configuration template](https://raw.githubusercontent.com/joohoi/acme-dns/master/config.cfg) to `config/config.cfg`
127+
128+
4) Modify the config.cfg to suit your needs.
129+
130+
5) Run Docker, this example expects that you have `port = "80"` in your config.cfg:
131+
```
132+
docker run --rm --name acmedns \
133+
-p 53:53 \
134+
-p 80:80 \
135+
-v /path/to/your/config:/etc/acme-dns:ro \
136+
-v /path/to/your/data:/var/lib/acme-dns \
137+
-d joohoi/acme-dns
138+
```
139+
140+
## Docker Compose
141+
142+
1) Create directories: `config` for the configuration file, and `data` for the sqlite3 database.
143+
144+
2) Copy [configuration template](https://raw.githubusercontent.com/joohoi/acme-dns/master/config.cfg) to `config/config.cfg`
145+
146+
3) Copy [docker-compose.yml from the project](https://raw.githubusercontent.com/joohoi/acme-dns/master/docker-compose.yml), or create your own.
147+
148+
4) Edit the `config/config.cfg` and `docker-compose.yml` to suit your needs, and run `docker-compose up -d`
120149

121150
## Configuration
122151

config.cfg

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ debug = false
2727
# Database engine to use, sqlite3 or postgres
2828
engine = "sqlite3"
2929
# Connection string, filename for sqlite3 and postgres://$username:$password@$host/$db_name for postgres
30-
connection = "acme-dns.db"
30+
# Please note that the default Docker image uses path /var/lib/acme-dns/acme-dns.db for sqlite3
31+
connection = "/var/lib/acme-dns/acme-dns.db"
3132
# connection = "postgres://user:password@localhost/acmedns_db"
3233

3334
[api]
@@ -36,9 +37,9 @@ api_domain = ""
3637
# email to use for account registration for Let's Encrypt, used only if tls = "letsencrypt"
3738
le_email = "[email protected]"
3839
# listen ip eg. 127.0.0.1
39-
ip = "127.0.0.1"
40+
ip = "0.0.0.0"
4041
# listen port, eg. 443 for default HTTPS
41-
port = "8080"
42+
port = "80"
4243
# possible values: "letsencrypt", "cert", "none"
4344
tls = "none"
4445
# only used if tls = "cert"

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '2'
2+
services:
3+
acmedns:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
image: joohoi/acme-dns:latest
8+
ports:
9+
- "443:443"
10+
- "53:53"
11+
- "80:80"
12+
volumes:
13+
- ./config:/etc/acme-dns:ro
14+
- ./data:/var/lib/acme-dns

0 commit comments

Comments
 (0)