Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial fixes to support multi-arch container building #2524

Merged
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ build: bin/$(ARCH)/$(BIN)

build-controller:
@$(MAKE) run CMD=" \
goreleaser build --id $(BIN) --rm-dist --debug --snapshot \
&& cp dist/$(BIN)_linux_$(ARCH)_*/$(BIN) bin/$(ARCH)/$(BIN) \
GOOS=linux GOARCH=$(ARCH) goreleaser build --id $(BIN) --rm-dist --debug --snapshot --single-target \
&& cp dist/$(BIN)_linux_$(ARCH)*/$(BIN) bin/$(ARCH)/$(BIN) \
"

bin/$(ARCH)/$(BIN):
Expand Down
1 change: 0 additions & 1 deletion build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ build_licenses_info_image() {
exit 1
fi
docker run --rm ${mount_cmd} \
--platform linux/${ARCH}\
"ghcr.io/kanisterio/license-extractor:4e0a91a" \
--mode merge \
--source ${src_dir} \
Expand Down
5 changes: 3 additions & 2 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update && apt-get -y install apt-transport-https ca-certificates bas
&& update-ca-certificates

RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
&& echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list

RUN apt update && apt install -y docker-ce docker-ce-cli containerd.io \
&& apt-get clean
Expand All @@ -18,7 +18,8 @@ COPY --from=alpine/helm:3.12.2 /usr/bin/helm /usr/local/bin/

COPY --from=golangci/golangci-lint:v1.51.2 /usr/bin/golangci-lint /usr/local/bin/

RUN wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.18.0/kind-linux-amd64 \
RUN ARCH=$(uname -m | sed -e 's/aarch64/arm64/') && \
wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.18.0/kind-linux-${ARCH} \
Copy link
Contributor

Choose a reason for hiding this comment

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

This resolves into https://github.com/kubernetes-sigs/kind/releases/download/v0.18.0/kind-linux-x86_64 for amd64, so it doesn't exist.
Maybe getting it from the input argument instead of uname would be a better idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This resolves into https://github.com/kubernetes-sigs/kind/releases/download/v0.18.0/kind-linux-x86_64 for amd64, so it doesn't exist. Maybe getting it from the input argument instead of uname would be a better idea.

Sorry about that!

I updated to use the TARGETPLATFORM buildx argument. Buildx was already set up in the GH workflow for the build container, and I also added the platform parameter there to build for both platforms.

&& chmod +x /usr/local/bin/kind

RUN git config --global --add safe.directory /go/src/github.com/kanisterio/kanister
Expand Down