Dockerize application
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Luca 2023-03-05 17:53:03 +01:00
parent 1779ee5c8e
commit bb73bf0009
3 changed files with 50 additions and 0 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
.dockerignore
.drone.yml
.git*
Dockerfile
config.json
data
db.sqlite3
matrix-pretix

View File

@ -26,3 +26,16 @@ steps:
when: when:
event: event:
- tag - 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

29
Dockerfile Normal file
View File

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