-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (58 loc) · 2.52 KB
/
Copy pathDockerfile
File metadata and controls
74 lines (58 loc) · 2.52 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
###############################################################################
# Stage 1: Build the frontend
###############################################################################
FROM node:22-alpine AS frontend
WORKDIR /build/web
COPY web/package.json web/package-lock.json ./
RUN npm ci || npm install
COPY web/ ./
RUN npm run build
###############################################################################
# Stage 2: Build the SignPost Go binary
###############################################################################
FROM golang:1.24-alpine AS builder
ARG VERSION=dev
RUN apk add --no-cache gcc musl-dev sqlite-dev
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copy built frontend into the Go build context for embed
COPY --from=frontend /build/web/dist web/dist/
RUN CGO_ENABLED=1 go build -o signpost ./cmd/signpost/
###############################################################################
# Stage 3: Final image based on Maddy
###############################################################################
FROM foxcpp/maddy:0.9.2
# Install s6-overlay for process management
ARG S6_OVERLAY_VERSION=3.2.0.2
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz && \
rm /tmp/s6-overlay-*.tar.xz
# Install runtime dependencies
RUN apk add --no-cache curl sqlite-libs openssl msmtp
# Copy SignPost binary, templates, scripts, and changelog
COPY --from=builder /build/signpost /app/signpost
COPY templates/ /app/templates/
COPY scripts/ /app/scripts/
COPY CHANGELOG.md /app/CHANGELOG.md
# Copy s6 service definitions
COPY rootfs/ /
# Create data directory
RUN mkdir -p /data/signpost/dkim_keys /data/signpost/tls /data/signpost/logs /data/signpost/logs/maddy /data/signpost/backups
# Environment defaults
ENV SIGNPOST_DATA_DIR=/data/signpost \
SIGNPOST_TEMPLATE_PATH=/app/templates/maddy.conf.tmpl \
SIGNPOST_WEB_PORT=8080 \
SIGNPOST_SMTP_PORT=25 \
SIGNPOST_SUBMISSION_PORT=587 \
SIGNPOST_LOG_LEVEL=info
# Expose ports
EXPOSE 25 465 587 8080
# Health check — verifies both HTTP API and SMTP port
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -f http://localhost:8080/api/v1/healthz && echo QUIT | nc -w 2 localhost 25 || exit 1
# s6-overlay entrypoint
ENTRYPOINT ["/init"]