Files
nexodus/Containerfile.nexd
Hiram Chirino 77f958c18c Add a docker-compose configuration that can start the apiserver.
Also add the `dlv` debugger to the container images so that they can be remotely debugged if needed.

Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
2024-04-01 15:23:46 -04:00

101 lines
2.7 KiB
Docker

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/mkcert@v1.4.4
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