Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
66448e0
Add build support for arm64-linux
kaboing Dec 23, 2024
7f0262a
Add explicitly setting CC for aarch64-linux builds to fix cross-compi…
kaboing Jan 7, 2025
fc8dad5
Add package g++-aarch64-linux-gnu to quilkin-build
kaboing Jan 7, 2025
cd6b5a1
Update multiarch build to use docker-container as build driver
kaboing Jan 8, 2025
78cea0a
Add --load to load image into Docker
kaboing Jan 8, 2025
0aa6b83
Added --push to docker build command
kaboing Jan 9, 2025
de3dfc0
Merge branch 'main' into build-for-arm64
XAMPPRocky Jan 9, 2025
55deff7
Explicitly creating docker manifest for multi-arch build
kaboing Jan 17, 2025
09bbe46
Explicitly create manifest and push
kaboing Jan 17, 2025
306c963
Potential fix for docker manifest list tagging issue
kaboing Jan 22, 2025
1616d8c
Reinstate buildx builds again
kaboing Jan 22, 2025
a217a30
Add build support for arm64-linux
kaboing Dec 23, 2024
7b05b0f
Add explicitly setting CC for aarch64-linux builds to fix cross-compi…
kaboing Jan 7, 2025
b20b7d5
Add package g++-aarch64-linux-gnu to quilkin-build
kaboing Jan 7, 2025
062f1ef
Update multiarch build to use docker-container as build driver
kaboing Jan 8, 2025
b45d4c0
Add --load to load image into Docker
kaboing Jan 8, 2025
0b7e4a9
Added --push to docker build command
kaboing Jan 9, 2025
48fadc8
Explicitly creating docker manifest for multi-arch build
kaboing Jan 17, 2025
c70efb1
Explicitly create manifest and push
kaboing Jan 17, 2025
86ad4c2
Potential fix for docker manifest list tagging issue
kaboing Jan 22, 2025
a876cde
Reinstate buildx builds again
kaboing Jan 22, 2025
626e92b
Use buildx for multi-platform support on push
maggie44 Mar 29, 2025
c830d5f
Merge branch 'build-for-arm64' into build-for-arm64
maggie44 Mar 29, 2025
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*.exe
*.rlib

!target/image/quilkin
!target/image/linux/arm64/quilkin
!target/image/linux/amd64/quilkin
!dependencies-src.zip
!image/quilkin.yaml
41 changes: 25 additions & 16 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ rust_toolchain := $(shell grep channel $(project_path)/rust-toolchain.toml | awk

# if this is a release, don't put the sha, otherwise, leave it off.
ifdef QUILKIN_RELEASE
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk '{print $$3}')
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk -F'"' '{print $$2}')
else
git_sha := $(shell git rev-parse --short=7 HEAD)
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk '{print $$3}')-${git_sha}
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk -F'"' '{print $$2}')-${git_sha}
endif

# Set this value if you want to use an external registry
REPOSITORY ?= ""
IMAGE_TAG ?= ${REPOSITORY}quilkin:$(package_version)
IMAGE_TAG_ARM64 ?= ${REPOSITORY}quilkin-arm64:$(package_version)
IMAGE_TAG_AMD64 ?= ${REPOSITORY}quilkin-amd64:$(package_version)
PREV_IMAGE_TAG ?= us-docker.pkg.dev/quilkin/release/quilkin:0.8.0
MINIKUBE_PROFILE ?= quilkin
CARGO_TARGET_DIR ?= /workspace/target/build-image
Expand All @@ -57,6 +59,7 @@ gcloud_mount_args := -v $(build_path)/.config/gcloud:/root/.config/gcloud
cargo_build_x86_64_linux := build --profile=lto --target x86_64-unknown-linux-gnu
cargo_build_x86_64_apple := build --release --target x86_64-apple-darwin
cargo_build_aarch64-apple := build --release --target aarch64-apple-darwin
cargo_build_aarch64_linux := build --profile=lto --target aarch64-unknown-linux-gnu
cargo_build_x86_64_windows := build --release --target x86_64-pc-windows-gnu

# _____ _
Expand Down Expand Up @@ -103,14 +106,18 @@ binary-archive: ensure-build-image build-licence-report build-all-binaries
docker run --rm $(common_rust_args) -w $(CARGO_TARGET_DIR) \
--entrypoint=bash $(BUILD_IMAGE_TAG) -c 'cp ../../license.html . && zip ../../quilkin-$(package_version).zip ./*/lto/quilkin ./*/lto/quilkin.exe ./license.html'

# Build binary for x86_64-unknown-linux-gnu.
# Build binary for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu
# Use BUILD_LOCAL=1 to build through local cargo rather than through the build container.
build-linux-binary: ensure-build-image gen-protobuf
ifdef BUILD_LOCAL
cargo $(cargo_build_x86_64_linux)
cargo $(cargo_build_aarch64_linux)
else
docker run --rm $(common_rust_args) -e "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/x86_64-linux-gnu-gcc" \
--entrypoint=cargo $(BUILD_IMAGE_TAG) $(cargo_build_x86_64_linux)
docker run --rm $(common_rust_args) \
-e "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/x86_64-linux-gnu-gcc" \
-e "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" \
$(BUILD_IMAGE_TAG) \
sh -c "cargo $(cargo_build_x86_64_linux) && CC=aarch64-linux-gnu-gcc cargo $(cargo_build_aarch64_linux) --no-default-features"
endif

# Build binary for x86_64-pc-windows-gnu
Expand Down Expand Up @@ -147,15 +154,18 @@ endif
# Use BUILD_LOCAL=1 to build the binary through local cargo rather than through the build container.
build-image: ensure-build-image build-licence-report build-linux-binary
build-image:
-mkdir -p "$(project_path)/target/image/"
-mkdir -p "$(project_path)/target/image/linux/amd64"
-mkdir -p "$(project_path)/target/image/linux/arm64"
ifdef BUILD_LOCAL
cp "$(project_path)/target/x86_64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/"
cp "$(project_path)/target/x86_64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/linux/amd64/"
cp "$(project_path)/target/aarch64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/linux/arm64/"
else
cp "$(project_path)/target/build-image/x86_64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/"
cp "$(project_path)/target/build-image/x86_64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/linux/amd64/"
cp "$(project_path)/target/build-image/aarch64-unknown-linux-gnu/lto/quilkin" "$(project_path)/target/image/linux/arm64/"
endif
docker run --rm $(common_rust_args) \
--entrypoint=bash $(BUILD_IMAGE_TAG) -c './image/archive_dependencies.sh'
docker build --platform=linux/amd64 -t $(IMAGE_TAG) -f $(project_path)/image/Dockerfile $(project_path)
docker build -t $(IMAGE_TAG) -f $(project_path)/image/Dockerfile $(project_path)

# Generates the HTML report of all open source licence dependencies
build-licence-report: ensure-build-image
Expand All @@ -170,7 +180,9 @@ build-licence-report:
# to set those options.
# If a `kubectl` authentication failure occurs, run `kubectl get ns` to confirm access and refresh the Kubernetes
# authentication token, and try again if successful.
test-agones: push
ifndef SKIP_BUILD_IMAGE
test-agones: build-image
endif
test-agones:
$(MAKE) run-test-agones

Expand All @@ -189,13 +201,10 @@ run-test-agones:

# Convenience target to build and push quilkin images to a repository.
# Use `REPOSITORY` arg to specify the repository to push to.
# USe `SKIP_BUILD_IMAGE` if you want to skip building the image if it has been already built.
# See `build-image` for more details.
push:
ifndef SKIP_BUILD_IMAGE
push: build-image
endif
docker push $(IMAGE_TAG)
docker buildx create --use --name multi-platform-builder --driver docker-container
docker buildx build --platform=linux/amd64,linux/arm64 -t $(IMAGE_TAG) \
-f $(project_path)/image/Dockerfile $(project_path) --push

# Convenience target to build and push quilkin images into a minikube instance
# Use `MINIKUBE_PROFILE` to specify the profile. Defaults to `quilkin`.
Expand Down
12 changes: 6 additions & 6 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \
RUN set -eux && \
apt-get update && \
apt-get install -y lsb-release jq curl wget zip git build-essential software-properties-common protobuf-compiler \
libssl-dev pkg-config bash-completion g++-x86-64-linux-gnu g++-mingw-w64-x86-64 && \
libssl-dev pkg-config bash-completion g++-x86-64-linux-gnu g++-mingw-w64-x86-64 g++-aarch64-linux-gnu && \
echo "source /etc/bash_completion" >> /root/.bashrc

# install protoc-gen-doc
Expand Down Expand Up @@ -60,11 +60,11 @@ RUN git config --global --add safe.directory /workspace
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu';; \
armhf) rustArch='armv7-unknown-linux-gnueabihf';; \
arm64) rustArch='aarch64-unknown-linux-gnu';; \
i386) rustArch='i686-unknown-linux-gnu';; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
amd64) rustArch='x86_64-unknown-linux-gnu';; \
armhf) rustArch='armv7-unknown-linux-gnueabihf';; \
arm64) rustArch='aarch64-unknown-linux-gnu';; \
i386) rustArch='i686-unknown-linux-gnu';; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac && \
wget --quiet "https://static.rust-lang.org/rustup/dist/${rustArch}/rustup-init" && \
chmod +x rustup-init; \
Expand Down
5 changes: 3 additions & 2 deletions image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/distroless/cc-debian12:nonroot as base
FROM gcr.io/distroless/cc-debian12:nonroot AS base
WORKDIR /
ARG TARGETPLATFORM
COPY ./license.html .
COPY ./dependencies-src.zip .
COPY --chown=nonroot:nonroot ./target/image/quilkin .
COPY --chown=nonroot:nonroot ./target/image/${TARGETPLATFORM}/quilkin .

USER nonroot:nonroot
ENTRYPOINT ["/quilkin"]
Loading