forked from ThelabDevelopment/netmgr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
43 lines (35 loc) · 910 Bytes
/
Dockerfile.alpine
File metadata and controls
43 lines (35 loc) · 910 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
# Alpine-based lightweight image
FROM alpine:3.18 AS builder
# Install build dependencies
RUN apk add --no-cache \
build-base \
cmake \
ninja \
jsoncpp-dev \
git
WORKDIR /app
COPY . .
# Build with static linking for Alpine
RUN cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXE_LINKER_FLAGS="-static" && \
cmake --build build --config Release
# Runtime stage
FROM alpine:3.18
# Install runtime dependencies
RUN apk add --no-cache \
iproute2 \
iptables \
bind-tools \
iputils \
traceroute \
netcat-openbsd
# Copy binary
COPY --from=builder /app/build/netmgr /usr/local/bin/netmgr
# Create user and directories
RUN addgroup -S netmgr && adduser -S netmgr -G netmgr && \
mkdir -p /etc/netmgr /var/log/netmgr && \
chown netmgr:netmgr /etc/netmgr /var/log/netmgr
USER netmgr
ENTRYPOINT ["/usr/local/bin/netmgr"]
CMD ["--help"]