Add docker files

Build: docker build
This commit is contained in:
Dirk Nederveen 2022-11-13 16:24:25 +01:00
parent b5091cc5e1
commit 5d36d0ecf9
Signed by: dirk
GPG Key ID: 30C016E96E2219B8
3 changed files with 35 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
honk.db*
blob.db*
./honk

17
Dockerfile Normal file
View File

@ -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"]

15
docker-entrypoint.sh Executable file
View File

@ -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 $*