Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM golang:1.22.7-bullseye AS builder

WORKDIR /app

# Install dependencies for ebpf compilation
RUN apt update \
&& apt install --no-install-recommends -y clang llvm gcc libbpf-dev \
&& rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You deleted the apt cache here, and then populated the apt cache again on line10.


RUN apt-get update && apt-get install -y linux-headers-arm64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arm64 => $(dpkg-architecture -qDEB_TARGET_ARCH_CPU)


RUN ln -s /usr/include/aarch64-linux-gnu/asm/ /usr/include/asm \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aarch64-linux-gnu => $(dpkg-architecture -qDEB_TARGET_MULTIARCH)

&& ln -s /usr/include/aarch64-linux-gnu/sys/ /usr/include/sys \
&& ln -s /usr/include/aarch64-linux-gnu/bits/ /usr/include/bits \
&& ln -s /usr/include/aarch64-linux-gnu/gnu/ /usr/include/gnu

RUN go install github.com/swaggo/swag/cmd/swag@v1.8.12

COPY go.mod go.sum ./
COPY cmd cmd

ARG BPF_ENABLE_LOG "0"
ARG BPF_ENABLE_ROUTE_CACHE "0"
RUN BPF_CFLAGS="" \
&& if [ "$BPF_ENABLE_LOG" = "1" ]; then BPF_CFLAGS="$BPF_CFLAGS -DENABLE_LOG"; fi \
&& if [ "$BPF_ENABLE_ROUTE_CACHE" = "1" ]; then BPF_CFLAGS="$BPF_CFLAGS -DENABLE_ROUTE_CACHE"; fi \
&& BPF_CFLAGS=$BPF_CFLAGS go generate -v ./cmd/...
RUN CGO_ENABLED=0 go build -v -o bin/eupf ./cmd/

FROM alpine:3.18.5 AS runtime
LABEL org.opencontainers.image.source="https://github.com/edgecomllc/eupf"

COPY --from=builder /app/bin/ /app/bin/
COPY --from=builder /app/cmd/docs/swagger.* /app/
COPY --from=builder /app/cmd/ebpf/zeroentrypoint_bpf.o /app/
COPY ./entrypoint.sh /app/bin/entrypoint.sh

# CMD is overridden if arguments are passed.
ENTRYPOINT [ "sh", "/app/bin/entrypoint.sh" ]