From abb8d91d8a74d914728c6b6ad67ba2ba551fbca6 Mon Sep 17 00:00:00 2001 From: Martin Hebnes Pedersen Date: Sat, 7 Oct 2023 12:23:18 +0200 Subject: [PATCH] Add Dockerfile and docker-compose.yml --- .gitignore | 1 + Dockerfile | 20 ++++++++++++++++++++ docker-compose.yml | 7 +++++++ 3 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 8977b37b..c0a8a7e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .build/ pat pat*.pkg +docker-data/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..31e11daa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:alpine as builder +RUN apk add --no-cache git +WORKDIR /src +ADD go.mod go.sum ./ +RUN go mod download +ADD . . +RUN go build -o /src/pat + +FROM gcr.io/distroless/static +LABEL org.opencontainers.image.source=https://github.com/la5nta/pat +LABEL org.opencontainers.image.description="Pat - A portable Winlink client for amateur radio email" +LABEL org.opencontainers.image.licenses=MIT +COPY --from=builder /src/pat /bin/pat +USER 65534:65534 +WORKDIR /app +ENV XDG_CONFIG_HOME=/app +ENV XDG_DATA_HOME=/app +ENV XDG_STATE_HOME=/app +EXPOSE 8080 +ENTRYPOINT ["/bin/pat", "http", "--addr", ":8080"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..fe47ae4f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + pat: + build: . + volumes: + - ./docker-data:/app/pat + ports: + - 8080:8080