From 5d36d0ecf93b412d4573bbfb735ef63f0a28f8b9 Mon Sep 17 00:00:00 2001 From: Dirk Nederveen Date: Sun, 13 Nov 2022 16:24:25 +0100 Subject: [PATCH] Add docker files Build: docker build --- .dockerignore | 3 +++ Dockerfile | 17 +++++++++++++++++ docker-entrypoint.sh | 15 +++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 docker-entrypoint.sh 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 $* +