-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 911 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 911 Bytes
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
# Stage 1: Build stage
FROM golang:1.25 AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
gcc \
libsqlite3-dev \
make \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy all source files including templates for embedding
COPY *.go ./
COPY templates ./templates
COPY Makefile ./
# Build the application statically with embedded templates
RUN make mailsink-static
# Stage 2: Runtime stage using Google distroless
FROM gcr.io/distroless/static
# Copy only the binary from builder (templates are embedded)
COPY --from=builder /app/mailsink /mailsink
# Create data directory
VOLUME ["/data"]
# Expose ports
EXPOSE 2525 8080
# Set the entrypoint with database path and bind to all interfaces
ENTRYPOINT ["/mailsink", "-smtp", "0.0.0.0:2525", "-http", "0.0.0.0:8080", "-db", "/data/mailsink.db"]