diff --git a/docker/ddns/Dockerfile b/docker/ddns/Dockerfile index 1aba4eb..7610368 100644 --- a/docker/ddns/Dockerfile +++ b/docker/ddns/Dockerfile @@ -2,6 +2,7 @@ FROM golang:alpine RUN apk add --no-cache git +COPY docker/ddns/entrypoint.sh /entrypoint.sh WORKDIR /go/src/github.com/pboehm/ddns COPY . . @@ -11,8 +12,4 @@ RUN GO111MODULE=on go install -v ./... ENV GIN_MODE release ENV DDNS_EXPIRATION_DAYS 10 -CMD /go/bin/ddns \ - --domain=${DDNS_DOMAIN} \ - --soa_fqdn=${DDNS_SOA_DOMAIN} \ - --redis=${DDNS_REDIS_HOST} \ - --expiration-days=${DDNS_EXPIRATION_DAYS} +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/ddns/entrypoint.sh b/docker/ddns/entrypoint.sh new file mode 100755 index 0000000..8348443 --- /dev/null +++ b/docker/ddns/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +if [[ $# -eq 0 ]]; then + + if [[ "${DEBUG_MODE:-false}" == "true" ]]; then + /go/bin/ddns \ + --domain=${DDNS_DOMAIN} \ + --soa_fqdn=${DDNS_SOA_DOMAIN} \ + --redis=${DDNS_REDIS_HOST} \ + --expiration-days=${DDNS_EXPIRATION_DAYS} \ + --verbose + else + /go/bin/ddns \ + --domain=${DDNS_DOMAIN} \ + --soa_fqdn=${DDNS_SOA_DOMAIN} \ + --redis=${DDNS_REDIS_HOST} \ + --expiration-days=${DDNS_EXPIRATION_DAYS} + fi + +else + "$@" +fi