From 9b2805bcc42de1066091439d47062f93301a0f1d Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 3 Jun 2021 02:27:13 +0200
Subject: [PATCH] Fix entirely broken config mechanism

This patch fixes various problems of the image. Starting by the config
location, the removal of unneeded source code files and creating the
configuration files in the actual system locations instead of randomly
on the filesystem.

This should make sure that the container image can successfully built
and published again. While I'm still a bit puzzled on why it worked in
first place.
---
 Dockerfile    | 8 ++++++--
 entrypoint.sh | 3 +--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 7cf951b..114fe2b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,8 +7,12 @@ RUN true \
     && git clone https://github.com/m13253/dns-over-https.git --depth 1 -b "$VERSION" \
     && cd dns-over-https \
     && make \
+    && make install \
+    && rm -rf /go/dns-over-https/doh-server \
     && apk del .build-utils \
-    && adduser -h /go/dns-over-https/doh-server -S doh \
+    && adduser -h /etc/dns-over-https -S doh \
+    && chown -R doh /etc/dns-over-https \
+    && chmod -R 0700 /etc/dns-over-https \
     && true
 
 COPY ./entrypoint.sh /usr/local/bin/entrypoint
@@ -23,4 +27,4 @@ HEALTHCHECK CMD curl "http://localhost:8053/dns-query?name=${DOH_HEALTHCHECK_DOM
 
 EXPOSE 8053
 
-CMD ["./dns-over-https/doh-server/doh-server"]
+CMD ["doh-server", "-conf", "/etc/dns-over-https/doh-server.conf"]
diff --git a/entrypoint.sh b/entrypoint.sh
index 80ce4bd..dea6b90 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -4,8 +4,7 @@ if [ "$UPSTREAM_NAME" != "" ]; then
     UPSTREAM="$(getent hosts "$UPSTREAM_NAME" | awk '{print $1}'):53"
 fi
 
-#cat > ./dns-over-https/doh-server/doh-server.conf <<EOF
-cat > ./doh-server.conf <<EOF
+cat > /etc/dns-over-https/doh-server.conf <<EOF
 
 # HTTP listen port
 listen = [
-- 
GitLab