diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2f2426a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +honk.db* +blob.db* +./honk diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f11f457 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.16 + +RUN apt update && apt install -y libsqlite3-dev && rm -rf /var/cache/apt/* + +RUN mkdir /honk-src +COPY *.go docs/ toys/ vendor/ views/ /honk-src/ + +WORKDIR /honk-src + +RUN make +RUN mv ./honk /bin/honk + +CMD ["/bin/honk", "-datadir", "/honk-data"] + +COPY docker-entrypoint.sh /honk-src/docker-entrypoint.sh +ENTRYPOINT ["/honk-src/docker-entrypoint.sh"] + diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..d0a253b --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ ! -r "/honk-data/honk.db" ]; then + set -u + ( + echo "$HONK_USERNAME" + echo "$HONK_PASSWORD" + echo "${HONK_LISTEN_ADDR:-"0.0.0.0:8080"}" + echo "${HONK_SERVER_HOSTNAME}" + ) | honk -datadir "/honk-data" init + set +u +fi + +exec $* +