Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions .pipelines/npm/npm-conformance-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ stages:
AZURE_CLUSTER: "conformance-v2-background"
PROFILE: "v2-background"
IS_STRESS_TEST: "false"
OS_SKU: "Ubuntu"
v2-ws22:
AZURE_CLUSTER: "conformance-v2-ws22"
PROFILE: "v2-default-ws22"
IS_STRESS_TEST: "false"
OS_SKU: "Ubuntu"
v2-linux-stress:
AZURE_CLUSTER: "conformance-v2-linux-stress"
PROFILE: "v2-background"
IS_STRESS_TEST: "true"
OS_SKU: "Ubuntu"
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
demands:
Expand Down Expand Up @@ -210,6 +213,7 @@ stages:
--resource-group $(RESOURCE_GROUP) \
--name $(AZURE_CLUSTER) \
--network-plugin azure
Copy link
Contributor

Choose a reason for hiding this comment

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

going to need a \

----os-sku $(OS_SKU)
Copy link
Contributor

Choose a reason for hiding this comment

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

too many - :)


if [ $? != 0 ]
then
Expand Down
30 changes: 27 additions & 3 deletions npm/linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,36 @@ FROM mcr.microsoft.com/oss/go/microsoft/golang:1.23 AS builder
ARG VERSION
ARG NPM_AI_PATH
ARG NPM_AI_ID
RUN apt-get update && apt-get install -y iptables ipset ca-certificates conntrack grep && apt-get autoremove -y && apt-get clean
Copy link
Collaborator

@rbtr rbtr Nov 13, 2024

Choose a reason for hiding this comment

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

make this a separate build stage to keep the concerns distinct and so it can parallelize - let the Go builder only build Go and we'll make an iptables target to get those bits.

move to something like

FROM mariner-core AS iptables
RUN tdnf install -y iptables etc

then change your copies to --from iptables

WORKDIR /usr/local/src
COPY . .
RUN CGO_ENABLED=0 go build -v -o /usr/local/bin/azure-npm -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" npm/cmd/*.go
RUN chmod +x /usr/local/bin/azure-npm

FROM mcr.microsoft.com/mirror/docker/library/ubuntu:20.04 as linux
FROM mcr.microsoft.com/cbl-mariner/distroless/minimal@sha256:63a0a70ceaa1320bc6eb98b81106667d43e46b674731ea8d28e4de1b87e0747f AS linux
COPY --from=builder /usr/local/bin/azure-npm /usr/bin/azure-npm
RUN apt-get update && apt-get install -y iptables ipset ca-certificates && apt-get autoremove -y && apt-get clean
RUN chmod +x /usr/bin/azure-npm
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /lib/ /lib
COPY --from=builder /usr/lib/ /usr/lib
COPY --from=builder /usr/sbin/ /usr/sbin/

# Copy iptables, iptables-nft, and iptables-nft-save binaries
COPY --from=builder /usr/sbin/iptables /usr/sbin/iptables
COPY --from=builder /usr/sbin/iptables-nft /usr/sbin/iptables-nft
COPY --from=builder /usr/sbin/iptables-restore /usr/sbin/iptables-restore
COPY --from=builder /usr/sbin/iptables-save /usr/sbin/iptables-save
COPY --from=builder /usr/sbin/iptables-nft-restore /usr/sbin/iptables-nft-restore
COPY --from=builder /usr/sbin/iptables-nft-save /usr/sbin/iptables-nft-save
COPY --from=builder /usr/sbin/conntrack /usr/sbin/conntrack
COPY --from=builder /bin/grep /bin/grep

# Copy required libraries based on ldd output
COPY --from=builder /lib/x86_64-linux-gnu/libxtables.so.12 /lib/x86_64-linux-gnu/libxtables.so.12
COPY --from=builder /lib/x86_64-linux-gnu/libmnl.so.0 /lib/x86_64-linux-gnu/libmnl.so.0
COPY --from=builder /lib/x86_64-linux-gnu/libnftnl.so.11 /lib/x86_64-linux-gnu/libnftnl.so.11
COPY --from=builder /lib/x86_64-linux-gnu/libnetfilter_conntrack.so.3 /lib/x86_64-linux-gnu/libnetfilter_conntrack.so.3
COPY --from=builder /lib/x86_64-linux-gnu/libnfnetlink.so.0 /lib/x86_64-linux-gnu/libnfnetlink.so.0
COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6
COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2

ENTRYPOINT ["/usr/bin/azure-npm", "start"]
Loading