~migadu/alps-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH] Add Dockerfile

Details
Message ID
<20200515192529.93167-1-senan@senan.xyz>
DKIM signature
missing
Download raw message
Patch: +16 -0
example docker-compose:

```yml
alps:
  build: alps
  expose:
  - 80
  restart: unless-stopped
  command:
    - -theme
    - alps
    - imaps://imap.fastmail.com:993
    - smtps://smtp.fastmail.com:465
```
---
 Dockerfile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Dockerfile

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..472a254
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
FROM golang:1.14-alpine AS builder
RUN apk --no-cache add ca-certificates
WORKDIR /src
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o alps -tags netgo -v -a -ldflags '-extldflags "-static"' cmd/alps/main.go

FROM scratch
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"]
-- 
2.26.2
Details
Message ID
<0MtQTdympd3VCkT6ZTn34ll5GhOKEo1MpMXcezfmkOY336xVhV8bPFnjZ457KFJdzVNXU--fMdfH_yzN-Rz9BMTZ6_6gjtnHLq3I-uy9kSE=@emersion.fr>
In-Reply-To
<20200515192529.93167-1-senan@senan.xyz> (view parent)
DKIM signature
missing
Download raw message
Thanks for the patch! However I don't think we're interested in
maintaining a Dockerfile upstream.

[PATCH] optimize and simplify Dockerfile

Antoine Beaupré <anarcat@debian.org>
Details
Message ID
<87zgfyhfwv.fsf@angela.anarc.at>
In-Reply-To
<20200515192529.93167-1-senan@senan.xyz> (view parent)
DKIM signature
missing
Download raw message
Patch: +6 -7
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-certificates
WORKDIR /src
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
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
Antoine Beaupré <anarcat@orangeseeds.org>
Details
Message ID
<871qtaiuht.fsf@angela.anarc.at>
In-Reply-To
<0MtQTdympd3VCkT6ZTn34ll5GhOKEo1MpMXcezfmkOY336xVhV8bPFnjZ457KFJdzVNXU--fMdfH_yzN-Rz9BMTZ6_6gjtnHLq3I-uy9kSE=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
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.
Reply to thread Export thread (mbox)