Skip to content

Commit

Permalink
CI: Build arm64 kvm image on actual arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed May 24, 2023
1 parent 9418277 commit 0364336
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,13 @@ out/docker-machine-driver-kvm2-$(RPM_VERSION)-0.%.rpm: out/docker-machine-driver

.PHONY: kvm-image-amd64
kvm-image-amd64: installers/linux/kvm/Dockerfile.amd64 ## Convenient alias to build the docker container
docker build --build-arg "GO_VERSION=$(KVM_GO_VERSION)" -t $(KVM_BUILD_IMAGE_AMD64) -f $< $(dir $<)
docker build --platform linux/amd64 --build-arg "GO_VERSION=$(KVM_GO_VERSION)" -t $(KVM_BUILD_IMAGE_AMD64) -f $< $(dir $<)
@echo ""
@echo "$(@) successfully built"

.PHONY: kvm-image-arm64
kvm-image-arm64: installers/linux/kvm/Dockerfile.arm64 ## Convenient alias to build the docker container
docker build --build-arg "GO_VERSION=$(KVM_GO_VERSION)" -t $(KVM_BUILD_IMAGE_ARM64) -f $< $(dir $<)
docker build --platform linux/arm64 --build-arg "GO_VERSION=$(KVM_GO_VERSION)" -t $(KVM_BUILD_IMAGE_ARM64) -f $< $(dir $<)
@echo ""
@echo "$(@) successfully built"

Expand Down
34 changes: 12 additions & 22 deletions installers/linux/kvm/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,20 @@

FROM ubuntu:20.04

ARG GO_VERSION

RUN apt update

RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main universe multiverse" >> /etc/apt/sources.list && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe restricted multiverse" >> /etc/apt/sources.list && \
dpkg --add-architecture arm64 && \
(apt update || true)
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
make \
pkg-config \
curl \
libvirt-dev \
git \
&& rm -rf /var/lib/apt/lists/*

RUN DEBIAN_FRONTEND=noninteractive \
apt install \
-o APT::Immediate-Configure=false -y \
gcc-aarch64-linux-gnu \
make \
pkg-config \
curl \
libvirt-dev:arm64 && \
dpkg --configure -a
ARG GO_VERSION

RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzf -
RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz | tar -C /usr/local -xzf -

ENV GOPATH /go

ENV CC=aarch64-linux-gnu-gcc
ENV CGO_ENABLED=1
ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin

0 comments on commit 0364336

Please sign in to comment.