-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.node
More file actions
49 lines (36 loc) · 1005 Bytes
/
Dockerfile.node
File metadata and controls
49 lines (36 loc) · 1005 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
39
40
41
42
43
44
45
46
47
48
49
# Build stage
FROM golang:1.25.5-alpine AS builder
WORKDIR /build
# Install build dependencies
RUN apk add --no-cache gcc musl-dev sqlite-dev linux-headers
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build binary with optimizations
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o node ./cmd/node
# Runtime stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
iptables \
iproute2 \
wireguard-tools
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/node .
# Create config directory
RUN mkdir -p /etc/shadownet
# Expose WireGuard port
EXPOSE 51820/udp
# Set default environment variables
ENV PEER_ID=docker-node
ENV CONTROLPLANE_URL=http://controlplane:8080
# Run node (requires NET_ADMIN capability)
CMD ./node \
--id ${PEER_ID} \
--controlplane-url ${CONTROLPLANE_URL} \
--private-key-path /etc/shadownet/node.key \
--listen-port 51820