-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
53 lines (36 loc) · 1.33 KB
/
Dockerfile
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
52
53
ARG USER=tapa-user
ARG UID=10006
ARG HOME=/home/${USER}
FROM golang:1.24 as build
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
WORKDIR /app/examples/target
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"' -o target-client ./cmd/target-client
FROM ubuntu:22.04
ARG USER
ARG UID
ARG HOME
RUN apt-get update -y --fix-missing \
&& apt-get install -y iproute2 tcpdump net-tools iputils-ping netcat wget screen xz-utils strace \
&& setcap 'cap_sys_ptrace,cap_dac_override+ep' /usr/bin/ss \
&& setcap 'cap_sys_ptrace,cap_dac_override+ep' /usr/bin/netstat \
&& setcap 'cap_net_raw+ep' /usr/bin/ping \
&& setcap 'cap_net_raw+ep' /usr/bin/tcpdump \
&& setcap 'cap_sys_ptrace+ep' /usr/bin/strace
RUN groupadd --gid $UID $USER \
&& useradd $USER --create-home --home-dir $HOME --no-log-init --uid $UID --gid $UID \
&& chown -R :root "${HOME}" && chmod -R g+s=u "${HOME}"
WORKDIR $HOME
ADD https://github.com/Nordix/ctraffic/releases/download/v1.7.0/ctraffic.gz ctraffic.gz
RUN gunzip ctraffic.gz \
&& chmod a+x ctraffic
ADD https://github.com/Nordix/mconnect/releases/download/v2.2.0/mconnect.xz mconnect.xz
RUN unxz mconnect.xz \
&& chmod a+x mconnect
COPY --from=build /app/examples/target/target-client .
USER ${UID}:${UID}
CMD ./ctraffic -server -address [::]:5000