added buildx-qemu image

main
Ricard Illa 2022-08-16 22:57:31 +02:00
parent fc02adc694
commit b857c82f2a
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
5 changed files with 77 additions and 1 deletions

View File

@ -1,7 +1,7 @@
REGISTRY=registry.monotremata.xyz
PLATFORMS=linux/amd64,linux/arm64
IMAGES=agate mpd pleroma rainloop tor transmission webdav
IMAGES=agate buildx-qemu mpd pleroma rainloop tor transmission webdav
.PHONY: all $(IMAGES)
@ -12,6 +12,9 @@ BUILDX=docker buildx build --platform $(PLATFORMS) --tag $(REGISTRY)/$@ --push $
agate:
$(BUILDX)
buildx-qemu:
$(BUILDX)
mpd:
$(BUILDX)

View File

@ -16,6 +16,7 @@ docker registry.
## Currently implemented images:
* agate
* buildx-qemu (image I use to build the other images in my CI/CD)
* mpd
* pleroma
* rainloop
@ -23,6 +24,12 @@ docker registry.
* transmission
* webdav (really simple nginx + `nginx-mod-http-dav-ext` image)
## Create buildx driver
```sh
docker buildx create --use
```
## Enable multi-arch execution
```sh

30
buildx-qemu/Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM debian:bullseye-slim
ARG TARGETARCH
ENV DOCKER_URL=https://download.docker.com/linux/debian
ENV GPG_FILE=/etc/apt/keyrings/docker.gpg
ENV DEBIAN_VERSION=bullseye
RUN apt-get update && \
apt-get install -y \
ca-certificates \
curl \
gnupg && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL "$DOCKER_URL/gpg" | gpg --dearmor -o "$GPG_FILE" && \
echo "deb [arch=$TARGETARCH signed-by=$GPG_FILE] $DOCKER_URL $DEBIAN_VERSION stable" > \
/etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y \
binfmt-support \
docker-ce-cli \
make \
qemu-user-static && \
rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

29
buildx-qemu/Makefile Normal file
View File

@ -0,0 +1,29 @@
IMG_NAME=buildx-qemu
REGISTRY=registry.monotremata.xyz
IMG=$(REGISTRY)/$(IMG_NAME)
PLATFORMS=linux/amd64,linux/arm64
.PHONY: build push buildx
ARCH=$(shell uname -m)
ifeq ($(ARCH),x86_64)
TARGETARCH=amd64
else ifeq ($(ARCH),aarch64)
TARGETARCH=arm64
else
TARGETARCH=amd64
endif
build: Dockerfile entrypoint.sh
docker build -t $(IMG) --build-arg TARGETARCH=$(TARGETARCH) .
push: build
docker image push $(IMG)
buildx: Dockerfile entrypoint.sh
docker buildx build \
--platform $(PLATFORMS) \
--tag $(IMG) \
--push \
.

View File

@ -0,0 +1,7 @@
#!/bin/sh
update-binfmts --enable
docker buildx create --use
docker buildx inspect --bootstrap
exec "$@"