We keep the good stuff from the original implementation:
* statically compiled
* "FROM scratch"
* sets up a `ca-certificates` base
* ENTRYPOINT instead of CMD (so we don't have to do `docker run alps
alps -h`)
... but also add the following:
* go mod verify
* single-step COPY
* use the default golang image (Debian)
* use the latest golang image (1.18)
* use a non-privileged port (the default 1323) so this can run rootless
I also use a slightly different docker-compose.yml file.
---
version: "3.5"
services:
alps:
image: registry.gitlab.com/anarcat/alps
container_name: alps
restart: unless-stopped
command:
- -theme
- alps
- anarc.at
ports:
- "127.0.0.1:1323:1323"
user: "65534"
I'll try to maintain a container image out of this in the
aforementioned GitLab registry. I'd happily to this here on sr.ht
either, but I am not aware of such a thing existing here (yet?).
Containers are a perfect match for alps: it's stateless, can be
compiled statically, so it makes for a really neat little container.
---
Dockerfile | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 472a254..2fb7d14 100644
--- a/Dockerfile+++ b/Dockerfile
@@ -1,9 +1,8 @@
-FROM golang:1.14-alpine AS builder-RUN apk --no-cache add ca-certificates+FROM golang:1.18 AS builder+RUN apt update && apt install -y ca-certificatesWORKDIR /src
-COPY go.mod .-COPY go.sum .-RUN go mod download+COPY go.mod go.sum ./+RUN go mod download && go mod verifyCOPY . .
RUN CGO_ENABLED=0 go build -o alps -tags netgo -v -a -ldflags '-extldflags "-static"' cmd/alps/main.go
@@ -12,5 +11,5 @@ COPY --from=builder /etc/ssl/certs/* /etc/ssl/certs/
COPY --from=builder /src/alps /
COPY --from=builder /src/themes /themes
COPY --from=builder /src/plugins /plugins
-EXPOSE 80-ENTRYPOINT ["/alps", "-addr", ":80"]+EXPOSE 1323+ENTRYPOINT ["/alps"]
--
2.30.2
On 2020-05-19 12:55:01, Simon Ser wrote:
> Thanks for the patch! However I don't think we're interested in> maintaining a Dockerfile upstream.
Hm... this patch is still marked "PROPOSED" though, shouldn't it be
"REJECTED"?
--
Either you're with us or you're with the terrorist state.