From ab6ea729317f11e7e28485c437729360dcc91dc5 Mon Sep 17 00:00:00 2001 From: AKP Date: Wed, 5 Apr 2023 17:36:34 +0100 Subject: [PATCH] Add (awful) Dockerfile Signed-off-by: AKP --- Dockerfile | 27 +++++++++++++++++++++++++++ datasette_plugin/requirements.txt | 3 ++- docker-entrypoint.sh | 6 ++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4733791 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:1.20 as builder +RUN mkdir /build +ADD . /build/ +WORKDIR /build +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static" -s -w' -o main github.com/codemicro/analytics/ingest + +FROM python:3 +ENV PIP_DISABLE_PIP_VERSION_CHECK=on + +RUN mkdir -p /analytics/ds/ +WORKDIR /analytics + +COPY --from=builder /build/main ./ingest + +ADD datasette_plugin ds/plugins +ADD config/datasette-metadata.json ds/metadata.json +ADD docker-entrypoint.sh . + +RUN pip install --no-cache-dir datasette +RUN pip install --no-cache-dir -r ds/plugins/requirements.txt + +RUN mkdir -p /analytics/run +WORKDIR /analytics/run + +STOPSIGNAL SIGKILL + +CMD ["bash", "../docker-entrypoint.sh"] \ No newline at end of file diff --git a/datasette_plugin/requirements.txt b/datasette_plugin/requirements.txt index 4eb9455..3104097 100644 --- a/datasette_plugin/requirements.txt +++ b/datasette_plugin/requirements.txt @@ -1,2 +1,3 @@ dominate -pyyaml \ No newline at end of file +pyyaml +python-baseconv \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..674b143 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +datasette analytics.db --plugins-dir=../ds/plugins --metadata=../ds/metadata.json --setting base_url $BASE_URL --host 0.0.0.0 & +DS_PID=$! +../ingest +kill $DS_PID