Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasferrandiz committed May 23, 2024
1 parent 3183e14 commit 8e6af4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
17 changes: 4 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ RUN set -x && \
ARG TARGETPLATFORM
# setup required packages for cross-compilation
RUN set -x && \
xx-apk --no-cache add musl-dev gcc linux-headers \
zstd-static \
zlib-static \
libbpf-dev \
libpcap-dev \
libelf-static
xx-apk --no-cache add musl-dev gcc

FROM base-builder as builder
ARG TAG=v3.27.3
Expand All @@ -50,15 +45,13 @@ RUN mkdir -p /opt/xtables/ &&\
RUN tar xvf /opt/xtables/k3s-root-xtables.tar -C /opt/xtables
### END K3S XTABLES #####

#TDO check arch to use here
FROM calico/bird:v0.3.3-184-g202a2186-${BUILDARCH} AS calico_bird
FROM calico/bird:v0.3.3-184-g202a2186-${TARGETARCH} AS calico_bird

### BEGIN CALICOCTL ###
FROM builder AS calico_ctl
ARG TAG=v3.27.3
ARG GOEXPERIMENT
WORKDIR $GOPATH/src/github.com/projectcalico/calico/calicoctl
ARG TARGETPLATFORM
ARG TARGETARCH
RUN xx-go --wrap &&\
GO_LDFLAGS="-linkmode=external \
Expand All @@ -81,7 +74,6 @@ COPY dualStack-changes.patch .
# Apply the patch only in versions v3.20 and v3.21. It is already part of v3.22
RUN if [[ "${TAG}" =~ "v3.20" || "${TAG}" =~ "v3.21" ]]; then patch -p1 < dualStack-changes.patch; fi
ENV GO_LDFLAGS="-linkmode=external -X main.VERSION=${TAG}"
ARG TARGETPLATFORM
ARG TARGETARCH
RUN xx-go --wrap
RUN go-build-static.sh -gcflags=-trimpath=${GOPATH}/src -o bin/calico ./cmd/calico
Expand Down Expand Up @@ -121,7 +113,6 @@ WORKDIR $GOPATH/src/github.com/projectcalico/calico
RUN git fetch --all --tags --prune
RUN git checkout tags/${TAG} -b ${TAG}

### BEGIN CALICO NODE ###
### Can't use go-build-static.sh due to -Wl and --fatal-warnings flags ###
FROM nodebuilder AS calico_node
ARG ARCH
Expand Down Expand Up @@ -225,7 +216,7 @@ FROM scratch AS calico_rootfs_overlay_arm64
COPY --from=calico_node /go/src/github.com/projectcalico/calico/node/filesystem/etc/ /etc/
COPY --from=calico_node /go/src/github.com/projectcalico/calico/node/filesystem/licenses/ /licenses/
COPY --from=calico_node /go/src/github.com/projectcalico/calico/node/filesystem/sbin/ /usr/sbin/
COPY --from=calico_node /strip/bin /usr/bin/
COPY --from=strip_binary /strip/bin /usr/bin/
COPY --from=strip_binary /strip/flexvol/bin/flexvoldriver /usr/local/bin/flexvoldriver
COPY --from=calico_pod2daemon /usr/local/bin/ /usr/local/bin/
COPY --from=calico/bpftool:v5.3-arm64 /bpftool /usr/sbin/
Expand Down Expand Up @@ -260,4 +251,4 @@ COPY --from=calico_rootfs_overlay / /
ENV PATH=$PATH:/opt/cni/bin
RUN set -x && \
test -e /opt/cni/bin/install && \
ln -vs /opt/cni/bin/install /install-cni \
ln -vs /opt/cni/bin/install /install-cni
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ K3S_ROOT_VERSION ?= v0.13.0
ifeq (,$(filter %$(BUILD_META),$(TAG)))
$(error TAG $(TAG) needs to end with build metadata: $(BUILD_META))
endif

ARCH=arm64
.PHONY: image-build
image-build:
docker buildx build --no-cache \
Expand All @@ -30,7 +30,6 @@ image-build:
--tag $(ORG)/hardened-calico:$(TAG) \
--tag $(ORG)/hardened-calico:$(TAG)-$(ARCH) \
--load \
--progress=plain \
.

.PHONY: image-push
Expand Down

0 comments on commit 8e6af4a

Please sign in to comment.