Browse Source

Add Dockerfile and entrypoint.sh

Владимир Томишинец 5 years ago
parent
commit
6349393d79
2 changed files with 45 additions and 0 deletions
  1. 29 0
      Dockerfile
  2. 16 0
      entrypoint.sh

+ 29 - 0
Dockerfile

@@ -0,0 +1,29 @@
+FROM golang:1.12.10-alpine3.10 AS builder
+LABEL maintainer="joona@kuori.org"
+
+RUN apk add --update gcc musl-dev git \
+    && go get github.com/joohoi/acme-dns
+
+WORKDIR /go/src/github.com/joohoi/acme-dns
+
+RUN CGO_ENABLED=1 go build
+
+
+FROM alpine:3.10
+
+WORKDIR /root/
+COPY --from=builder /go/src/github.com/joohoi/acme-dns .
+COPY ./entrypoint.sh /entrypoint.sh
+RUN mkdir -p /etc/acme-dns && mkdir -p /var/lib/acme-dns && mkdir /etc/letsencrypt \
+    && rm -rf ./config.cfg \
+    && apk --no-cache add ca-certificates && update-ca-certificates \
+    && apk --no-cache add py-requests certbot curl python2 sqlite bash git \
+    && curl -o /etc/letsencrypt/acme-dns-auth.py \
+	https://raw.githubusercontent.com/joohoi/acme-dns-certbot-joohoi/master/acme-dns-auth.py \
+    && chmod 0700 /etc/letsencrypt/acme-dns-auth.py
+
+#VOLUME ["/etc/acme-dns", "/var/lib/acme-dns"]
+#ENTRYPOINT ["/entrypoint.sh"]
+EXPOSE 53 80 443
+EXPOSE 53/udp
+CMD ["./acme-dns"]

+ 16 - 0
entrypoint.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#Убиваем все что осталось с прошлого раза
+[ -d /pki ] && rm -rf /pki
+[ -f /var/lib/acme-dns/acme-dns.db ] && rm -f /var/lib/acme-dns/acme-dns.db
+
+GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}
+
+if [ $? == '0' ];then
+# Производим рестор БД    
+    zcat /pki/iru/wild/infoclinica.ru.dump.gz | sqlite3 /var/lib/acme-dns/acme-dns.db
+else
+    echo "Cannot git clone the ${git_url}"; exit 1
+fi
+
+exec "$@"