mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-05-12 18:43:02 +00:00
tools/alpine: multi-arch support for the base alpine image
Alpine is the base docker image for the LinuxKit, but currently it only supports amd64 architecture. This patch is try to unify the alpine tool docker image build process order to suport other architectures, such as AArch64, by using '--build-arg' to override the alpine base image specified by 'FROM' in the Dockerfile. Also this patch splits the standalone packages into 2 parts: one is common for all archs, another is arch-specific. Signed-off-by: Dennis Chen <dennis.chen@arm.com>
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
FROM alpine:3.6 AS mirror
|
||||
ARG BASE=alpine:3.6
|
||||
FROM $BASE AS mirror
|
||||
|
||||
# update base image
|
||||
RUN apk update && apk upgrade -a
|
||||
|
||||
# Copy Dockerfile so we can include it in the hash
|
||||
COPY Dockerfile /Dockerfile
|
||||
COPY packages /tmp/
|
||||
COPY packages* /tmp/
|
||||
|
||||
# mirror packages
|
||||
RUN mkdir -p /mirror/$(uname -m) && \
|
||||
RUN cat /tmp/packages.$(uname -m) >> /tmp/packages && \
|
||||
mkdir -p /mirror/$(uname -m) && \
|
||||
apk fetch --recursive -o /mirror/$(uname -m) $(apk info; cat /tmp/packages)
|
||||
|
||||
# add the tools for WireGuard, since the kernel module is now included, but from edge/testing
|
||||
@@ -28,7 +30,10 @@ RUN cp /mirror/$(uname -m)/APKINDEX.unsigned.tar.gz /mirror/$(uname -m)/APKINDEX
|
||||
RUN abuild-sign /mirror/$(uname -m)/APKINDEX.tar.gz
|
||||
|
||||
# fetch OVMF for qemu EFI boot (this is not added as a package)
|
||||
RUN apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/community ovmf
|
||||
RUN mkdir -p /usr/share/ovmf && \
|
||||
if [ $(uname -m) = x86_64 ]; then \
|
||||
apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/community ovmf; \
|
||||
fi
|
||||
|
||||
# set this as our repo but keep a copy of the upstream for downstream use
|
||||
RUN mv /etc/apk/repositories /etc/apk/repositories.upstream && echo "/mirror" > /etc/apk/repositories && apk update
|
||||
@@ -41,14 +46,14 @@ RUN go get -u github.com/golang/lint/golint
|
||||
RUN go get -u github.com/gordonklaus/ineffassign
|
||||
RUN go get -u github.com/LK4D4/vndr
|
||||
|
||||
FROM alpine:3.6
|
||||
FROM $BASE
|
||||
|
||||
COPY --from=mirror /etc/apk/repositories /etc/apk/repositories
|
||||
COPY --from=mirror /etc/apk/repositories.upstream /etc/apk/repositories.upstream
|
||||
COPY --from=mirror /etc/apk/keys /etc/apk/keys/
|
||||
COPY --from=mirror /mirror /mirror/
|
||||
COPY --from=mirror /go/bin /go/bin/
|
||||
COPY --from=mirror /usr/share/ovmf/bios.bin /usr/share/ovmf/bios.bin
|
||||
COPY --from=mirror /usr/share/ovmf/ /usr/share/ovmf/
|
||||
COPY --from=mirror /Dockerfile /Dockerfile
|
||||
|
||||
RUN apk update && apk upgrade -a
|
||||
|
||||
Reference in New Issue
Block a user