-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 1.09 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# syntax=docker/dockerfile:1
# Stage 1: Build
FROM golang:1.25.12-trixie AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pytest \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make check && mkdir -p /out && cp bin/imapproc /out/imapproc
# Stage 2: Minimal runtime image
FROM debian:trixie-slim
LABEL org.opencontainers.image.title="imapproc" \
org.opencontainers.image.description="Lightweight Go daemon that monitors IMAP mailbox and processes unread emails with external scripts" \
org.opencontainers.image.url="https://github.com/capi/go-imapproc" \
org.opencontainers.image.source="https://github.com/capi/go-imapproc"
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -g 1000 imapproc \
&& useradd -u 1000 -g 1000 -d /home/imapproc -s /bin/sh -m imapproc
COPY --from=builder /out/imapproc /usr/local/bin/imapproc
USER imapproc
ENTRYPOINT ["/usr/local/bin/imapproc"]