Skip to content
This repository was archived by the owner on Aug 22, 2022. It is now read-only.

Commit ac371dd

Browse files
committed
Merge branch 'qemu-5' into 'master'
Update to qemu 5 and add build for linux/arm/7 See merge request ix.ai/docker-buildx-qemu!5
2 parents 5b51326 + fbd9509 commit ac371dd

File tree

5 files changed

+64
-46
lines changed

5 files changed

+64
-46
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
22
# Job and build settings
33
CI_BUILD_IMAGE: "debian:stable-slim"
4-
CI_BUILDX_ARCHS: 'linux/amd64,linux/arm64'
4+
CI_BUILDX_ARCHS: 'linux/amd64,linux/arm64,linux/arm/7'
55
# Docker and BuildKit variables
66
DOCKER_DRIVER: overlay2
77
DOCKER_TLS_CERTDIR: "/certs"
@@ -27,7 +27,8 @@ services:
2727
interruptible: true
2828
image: ${CI_BUILD_IMAGE}
2929
before_script:
30-
- set -xeu
30+
- cp debian-backports-pin-600.pref /etc/apt/preferences.d/
31+
- cp debian-backports.list /etc/apt/sources.list.d/
3132
- apt-get update
3233
- |
3334
apt-get install -y --no-install-recommends \
@@ -37,18 +38,22 @@ services:
3738
\
3839
ca-certificates \
3940
\
40-
binfmt-support \
41-
qemu-user-static \
42-
\
4341
git \
4442
jq \
45-
curl
43+
curl \
44+
\
45+
binfmt-support \
46+
qemu-user-static
47+
# Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923479
48+
- c_rehash
4649
- curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
4750
- add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable"
4851
- apt-get update
49-
- apt-get install -y --no-install-recommends docker-ce-cli
52+
- |
53+
apt-get install -y --no-install-recommends \
54+
docker-ce-cli
5055
- export BUILDX_NAME="buildx-$(tr -cd '[:alnum:]' < /dev/urandom | fold -w6 | head -n1)"
51-
- docker version && docker buildx version
56+
- docker version && docker buildx version && qemu-x86_64-static --version
5257
- docker context create "${BUILDX_NAME}"
5358
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
5459
- docker buildx create --driver docker-container --name "${BUILDX_NAME}" --use "${BUILDX_NAME}"
@@ -81,6 +86,7 @@ build:dev:
8186
export DESTINATION="${DESTINATION} --tag=${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:${TAG}"; \
8287
fi
8388
- |
89+
set -x; \
8490
docker buildx build \
8591
--platform=$CI_BUILDX_ARCHS \
8692
--progress=plain \
@@ -108,6 +114,7 @@ build:release:
108114
export DESTINATION="${DESTINATION} --tag=${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:latest"; \
109115
fi
110116
- |
117+
set -x; \
111118
docker buildx build \
112119
--platform=$CI_BUILDX_ARCHS \
113120
--progress=plain \

Dockerfile

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
1-
FROM debian:stable-slim as BUILDER
2-
31
FROM debian:stable-slim
42
LABEL maintainer="docker@ix.ai" \
53
ai.ix.repository="ix.ai/docker-buildx-qemu"
64

5+
# TODO remove config.json this flag once it's not needed for `buildx` anymore
6+
COPY config.json /root/.docker/
7+
COPY debian-backports-pin-600.pref /etc/apt/preferences.d/
8+
COPY debian-backports.list /etc/apt/sources.list.d/
9+
710
# Upgrades the image, Installs docker and qemu
8-
RUN set -eux; \
9-
export DEBIAN_FRONTEND=noninteractive; \
10-
export TERM=linux; \
11-
apt-get update; \
12-
apt-get -y dist-upgrade; \
13-
apt-get install -y --no-install-recommends \
14-
apt-transport-https \
15-
gnupg2 \
16-
software-properties-common \
11+
RUN set -eux; \
12+
\
13+
export DEBIAN_FRONTEND=noninteractive; \
14+
export TERM=linux; \
1715
\
18-
ca-certificates \
16+
apt-get update; \
17+
apt-get install -y --no-install-recommends \
18+
apt-transport-https \
19+
gnupg2 \
20+
software-properties-common \
21+
\
22+
ca-certificates \
23+
\
24+
git \
25+
jq \
26+
curl \
27+
\
28+
binfmt-support \
29+
qemu-user-static \
30+
; \
31+
# Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923479
32+
c_rehash; \
1933
\
20-
binfmt-support \
21-
qemu-user-static \
34+
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -; \
35+
add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable"; \
36+
apt-get update; \
37+
apt-get install -y --no-install-recommends \
38+
docker-ce-cli \
39+
; \
40+
apt-get autoremove --purge -y \
41+
apt-transport-https \
42+
gnupg2 \
43+
software-properties-common \
44+
; \
45+
apt-get autoremove --purge -y; \
46+
rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* /tmp/*; \
2247
\
23-
git \
24-
jq \
25-
curl \
26-
; \
27-
\
28-
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - ; \
29-
add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable"; \
30-
apt-get update; \
31-
apt-get install -y --no-install-recommends \
32-
docker-ce-cli \
33-
; \
34-
\
35-
apt-get autoremove --purge -y \
36-
apt-transport-https \
37-
gnupg2 \
38-
software-properties-common \
39-
; \
40-
apt-get -y --purge autoremove; \
41-
rm -rf /var/lib/apt/lists/* /var/log/* /var/tmp/* /tmp/*; \
42-
\
43-
# TODO disable this flag once it's not needed for `buildx` anymore
44-
mkdir -p ~/.docker; \
45-
echo '{"experimental":"enabled"}' > ~/.docker/config.json; \
46-
docker buildx version
48+
# Versions
49+
qemu-i386-static --version; \
50+
docker buildx version

config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"experimental":"enabled"
3+
}

debian-backports-pin-600.pref

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Package: *
2+
Pin: release a=*backports
3+
Pin-Priority: 600

debian-backports.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deb http://deb.debian.org/debian stable-backports main

0 commit comments

Comments
 (0)