-
Notifications
You must be signed in to change notification settings - Fork 26
/
Containerfile.nexd
100 lines (82 loc) · 2.69 KB
/
Containerfile.nexd
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
FROM registry.access.redhat.com/ubi8/ubi as build
RUN if [ ! -d /usr/local/go ] ; then \
[[ $(uname -p) = "x86_64" ]] && ARCH="amd64" || ARCH="arm64" ; \
curl -sL https://go.dev/dl/go1.22.1.linux-${ARCH}.tar.gz -o /tmp/go.tgz; \
tar -C /usr/local -xzf /tmp/go.tgz; \
mkdir -p /go/bin; \
mkdir -p /go/src; \
fi
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/go"
RUN dnf update -qy && \
dnf install --setopt=install_weak_deps=False -qy \
make \
gcc \
git \
glibc-devel \
&& \
dnf clean all -y &&\
rm -rf /var/cache/yum
RUN go install github.com/go-delve/delve/cmd/dlv@latest
ARG BUILD_PROFILE=dev
ARG NEXODUS_PPROF=
ARG NEXODUS_RACE_DETECTOR=
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN NOISY_BUILD=y \
NEXODUS_RACE_DETECTOR=${NEXODUS_RACE_DETECTOR} \
NEXODUS_PPROF=${NEXODUS_PPROF} \
NEXODUS_BUILD_PROFILE=$BUILD_PROFILE \
make dist/nexd
RUN NOISY_BUILD=y \
NEXODUS_RACE_DETECTOR=${NEXODUS_RACE_DETECTOR} \
NEXODUS_PPROF=${NEXODUS_PPROF} \
NEXODUS_BUILD_PROFILE=$BUILD_PROFILE \
make dist/nexd-kstore
RUN NOISY_BUILD=y \
NEXODUS_RACE_DETECTOR=${NEXODUS_RACE_DETECTOR} \
NEXODUS_PPROF=${NEXODUS_PPROF} \
NEXODUS_BUILD_PROFILE=$BUILD_PROFILE \
make dist/nexctl
RUN CGO_ENABLED=0 go build \
-ldflags="-extldflags=-static" \
-o udping ./hack/udping
RUN CGO_ENABLED=0 go build \
-ldflags="-extldflags=-static" \
-o udpong ./hack/udpong
RUN CGO_ENABLED=0 go install \
-ldflags="-extldflags=-static" \
golang.zx2c4.com/wireguard
RUN cd / && CGO_ENABLED=0 go install filippo.io/[email protected]
FROM fedora:latest as fedora
RUN dnf update -qy && \
dnf install --setopt=install_weak_deps=False -qy \
bash-completion \
ca-certificates \
iputils \
iproute \
psmisc \
procps-ng \
nftables \
hostname \
netcat \
tcpdump \
tmux \
wireguard-tools \
&& \
dnf clean all -y &&\
rm -rf /var/cache/yum
COPY --chmod=755 ./hack/update-ca.sh /update-ca.sh
COPY --chmod=755 --from=build /src/dist/nexd /bin/nexd
COPY --chmod=755 --from=build /src/dist/nexd-kstore /bin/nexd-kstore
COPY --chmod=755 --from=build /src/dist/nexctl /bin/nexctl
COPY --chmod=755 --from=build /go/bin/mkcert /bin/mkcert
COPY --chmod=755 --from=build /go/bin/dlv /bin/dlv
COPY --chmod=755 --from=build /go/bin/wireguard /bin/nexd-wireguard-go
COPY --chmod=755 --from=build /src/udping /bin/udping
COPY --chmod=755 --from=build /src/udpong /bin/udpong
COPY --chmod=644 --from=build /src/contrib/bash_autocomplete /etc/bash_completion.d/nexd
COPY --chmod=644 --from=build /src/contrib/bash_autocomplete /etc/bash_completion.d/nexctl
CMD /update-ca.sh prod