Skip to content

Commit 05d23aa

Browse files
committed
Allow turning on --verbose mode by environment variable $DEBUG
- Run application by an entrypoint.sh script to allow more debug options
1 parent fdc1312 commit 05d23aa

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

docker/ddns/Dockerfile

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM golang:alpine
22

33
RUN apk add --no-cache git
44

5+
COPY docker/ddns/entrypoint.sh /entrypoint.sh
56
WORKDIR /go/src/github.com/pboehm/ddns
67
COPY . .
78

@@ -11,8 +12,4 @@ RUN GO111MODULE=on go install -v ./...
1112
ENV GIN_MODE release
1213
ENV DDNS_EXPIRATION_DAYS 10
1314

14-
CMD /go/bin/ddns \
15-
--domain=${DDNS_DOMAIN} \
16-
--soa_fqdn=${DDNS_SOA_DOMAIN} \
17-
--redis=${DDNS_REDIS_HOST} \
18-
--expiration-days=${DDNS_EXPIRATION_DAYS}
15+
ENTRYPOINT ["/entrypoint.sh"]

docker/ddns/entrypoint.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
if [[ $# -eq 0 ]]; then
4+
5+
if [[ "${DEBUG_MODE:-false}" == "true" ]]; then
6+
/go/bin/ddns \
7+
--domain=${DDNS_DOMAIN} \
8+
--soa_fqdn=${DDNS_SOA_DOMAIN} \
9+
--redis=${DDNS_REDIS_HOST} \
10+
--expiration-days=${DDNS_EXPIRATION_DAYS} \
11+
--verbose
12+
else
13+
/go/bin/ddns \
14+
--domain=${DDNS_DOMAIN} \
15+
--soa_fqdn=${DDNS_SOA_DOMAIN} \
16+
--redis=${DDNS_REDIS_HOST} \
17+
--expiration-days=${DDNS_EXPIRATION_DAYS}
18+
fi
19+
20+
else
21+
"$@"
22+
fi

docker/docker-compose.override.yml.sample

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ services:
66
DDNS_DOMAIN: d.example.net # <<< ADJUST DOMAIN
77
DDNS_SOA_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
88
DDNS_EXPIRATION_DAYS: 10
9+
DEBUG_MODE: "false"
910

1011
powerdns:
1112
ports:

0 commit comments

Comments
 (0)