From bb73bf00092c1b35371e51501838b8940af436cd Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 5 Mar 2023 17:53:03 +0100 Subject: [PATCH] Dockerize application --- .dockerignore | 8 ++++++++ .drone.yml | 13 +++++++++++++ Dockerfile | 29 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ff37f61 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.dockerignore +.drone.yml +.git* +Dockerfile +config.json +data +db.sqlite3 +matrix-pretix diff --git a/.drone.yml b/.drone.yml index a366ab9..a165737 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,3 +26,16 @@ steps: when: event: - tag + + - name: push + image: plugins/docker + settings: + auto_tag: yes + password: + from_secret: api_key + registry: git.luj0ga.de + repo: git.luj0ga.de/luca/matrix-prometheus + username: _ + when: + event: + - tag diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d2a4e6e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM golang:1.20 AS builder + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y libolm-dev + +WORKDIR /build + +COPY . . +RUN go build -ldflags="-s -w" -o matrix-pretix -v . + +FROM debian:bullseye-slim + +ARG DEBIAN_FRONTEND=noninteractive + +RUN groupadd --gid 999 --system matrix-pretix && useradd --gid 999 --system --uid 999 matrix-pretix + +RUN apt-get update && apt-get install -y ca-certificates libolm3 + +COPY --from=builder /build/matrix-pretix /usr/local/bin/matrix-pretix + +USER matrix-pretix + +VOLUME /data +WORKDIR /data + +EXPOSE 8080 + +CMD ["/usr/local/bin/matrix-pretix", "/config.json"]