forked from renergr1nch/splitter
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (37 loc) · 1.37 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (37 loc) · 1.37 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
# ===========================================================================
# Stage 1: Build the Go binary
# ===========================================================================
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /splitter .
# ===========================================================================
# Stage 2: Minimal runtime image
# ===========================================================================
FROM alpine:3.21
RUN apk add --no-cache \
tor \
haproxy \
privoxy \
ca-certificates \
curl \
&& rm -rf /var/cache/apk/*
COPY --from=builder /splitter /usr/local/bin/splitter
COPY templates/ /splitter/templates/
COPY configs/ /splitter/configs/
COPY entrypoint.sh /splitter/entrypoint.sh
RUN addgroup -S splitter 2>/dev/null || true && \
adduser -S -G splitter -H -h /splitter splitter 2>/dev/null || true && \
mkdir -p /tmp/splitter && \
chown -R splitter:splitter /tmp/splitter /splitter && \
chmod +x /splitter/entrypoint.sh
WORKDIR /splitter
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -sf http://localhost:63540/status || exit 1
EXPOSE 63536 63537 63540
USER splitter
ENTRYPOINT ["/splitter/entrypoint.sh"]
CMD []