Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
- setup_remote_docker
- run:
name: Build Docker image
command: docker build . --pull
command: ./build.sh
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
FROM alpine:3.11
#Add qemu function for supporting multiarch
ARG IMAGEARCH
FROM alpine:3.12 as qemu
RUN apk add --no-cache curl
ARG QEMUVERSION=4.0.0
Copy link
Owner

Choose a reason for hiding this comment

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

🙋 This version of QEMU for multiple architectures is over a year old now. Could a more recent version be used instead? Even the v4.0.x series has had v4.0.0-4 released subsequently.

ARG QEMUARCH

SHELL ["/bin/ash", "-o", "pipefail", "-c"]
Copy link
Owner

Choose a reason for hiding this comment

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

🙋 Is it necessary to change the default shell options? You could break the curl | tar command into separate RUN steps and the resulting build would be easier to debug (e.g. if there were issues with a network connection to https://github.com).


RUN curl -fsSL https://github.com/multiarch/qemu-user-static/releases/download/v${QEMUVERSION}/qemu-${QEMUARCH}-static.tar.gz | tar zxvf - -C /usr/bin
RUN chmod +x /usr/bin/qemu-*

FROM ${IMAGEARCH}alpine:3.11
Copy link
Owner

Choose a reason for hiding this comment

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

🙋 The two Alpine versions don't match. Was this intentional?

ARG QEMUARCH
COPY --from=qemu /usr/bin/qemu-${QEMUARCH}-static /usr/bin/

RUN apk --no-cache add alpine-sdk coreutils cmake \
&& adduser -G abuild -g "Alpine Package Builder" -s /bin/ash -D builder \
&& echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
Expand Down
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e

export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

# Build x86 images
docker build --build-arg IMAGEARCH= \
--build-arg QEMUARCH="x86_64" \
--file Dockerfile --tag sgerrand/alpine-abuilder:amd64 . --pull
Copy link
Owner

Choose a reason for hiding this comment

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

🙋 The images for this project are currently tagged by Alpine version. I'd prefer to keep that prefix in front of any architecture related tag, such as amd64.

# Build arm64 image
docker build --build-arg IMAGEARCH="arm64v8/" \
--build-arg QEMUARCH="aarch64" \
--file Dockerfile --tag sgerrand/alpine-abuilder:arm64 . --pull
Copy link
Owner

Choose a reason for hiding this comment

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

As per the previous comment.