-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 885 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (23 loc) · 885 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
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code
COPY . .
# Build the statically linked Go binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o pocketsentry .
# ---------------------------------------------------
# Stage 2: Final lightweight image
# ---------------------------------------------------
FROM alpine:latest
# Add CA certificates so Webhooks (Telegram/Discord) can use HTTPS securely
RUN apk --no-cache add ca-certificates
WORKDIR /app
# Copy the built binary from the builder stage
COPY --from=builder /app/pocketsentry .
# Create a directory for the SQLite database so it can be mounted as a volume
RUN mkdir -p /data
EXPOSE 8080
# Run the binary, pointing the database to the /data directory
ENTRYPOINT ["./pocketsentry", "--db", "/data/pocketsentry.db"]