+23
-4
@@ -1,5 +1,24 @@
|
||||
FROM alpine
|
||||
# Build stage
|
||||
FROM docker.io/library/golang:1.26-alpine AS builder
|
||||
|
||||
RUN apk add --update --no-cache iptables iptables-legacy openssl jq curl ca-certificates busybox-extras docker-cli
|
||||
COPY firewall/ /firewall/
|
||||
CMD firewall/iptables-wrapper-installer.sh && /firewall/firewall-add
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -o network-go -ldflags="-s -w" .
|
||||
|
||||
# Runtime stage
|
||||
FROM docker.io/library/alpine:latest
|
||||
|
||||
RUN apk add --update --no-cache \
|
||||
iptables \
|
||||
iptables-legacy \
|
||||
ca-certificates \
|
||||
util-linux \
|
||||
nsenter \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
COPY --from=builder /build/network-go /usr/local/bin/network-go
|
||||
|
||||
CMD ["/usr/local/bin/network-go"]
|
||||
Reference in New Issue
Block a user