From 4bc5151b3ea631f112410d5827dcd6bf83e23cb7 Mon Sep 17 00:00:00 2001 From: James Brumond Date: Sat, 3 Dec 2022 20:12:54 -0800 Subject: [PATCH] updates for multi-arch builds --- .drone.yml | 64 +++++++++++++++++------------------------------------- Dockerfile | 16 +++++++++----- 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/.drone.yml b/.drone.yml index 676bfe3..1c7a8f9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,45 +1,21 @@ --- -kind: pipeline -type: kubernetes -name: build - -trigger: - event: [ push ] - branch: [ master ] - -steps: -- name: build - # See: https://plugins.drone.io/plugins/docker - image: plugins/docker - settings: - registry: https://gitea.internal.example.com - username: drone - password: - from_secret: gitea-internal-password - repo: gitea.internal.example.com/examples/docker - cache_from: gitea.internal.example.com/examples/docker:ci - tags: - - "ci" - ---- -kind: pipeline -type: kubernetes -name: publish - -trigger: - event: [ promote ] - target: [ publish ] - -steps: -- name: build-and-publish - # See: https://plugins.drone.io/plugins/docker - image: plugins/docker - settings: - registry: https://gitea.internal.example.com - username: drone - password: - from_secret: gitea-internal-password - repo: gitea.internal.example.com/examples/docker - cache_from: gitea.internal.example.com/examples/docker:ci - tags: - - "latest" \ No newline at end of file +kind: template +load: multiarch-container.yaml +data: + repo: images/docker + # because this *is* the docker image, the "latest" tag hasn't been published yet (that's + # what we're about to do), so we need to pick a specific arch image. + # todo: is there some way to choose this value automatically to match the runner? + docker_image_tag: latest-linux-arm64 + build_args: + # `apk info docker` to get latest version + - DOCKER_VERSION=20.10.21-r1 + tags: + - "20.10.21" + - "20.10" + - "20" + platforms: + - os: linux + arch: arm64 + # - os: linux + # arch: amd64 diff --git a/Dockerfile b/Dockerfile index 2e3d218..93e2ab3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,19 @@ -FROM alpine:3.16 +FROM alpine:3.17 ENV DOCKER_HOST=unix:///var/run/docker.sock -RUN apk --no-cache add --update docker openrc bash +ARG DOCKER_VERSION + +RUN apk --no-cache add --update \ + docker=$DOCKER_VERSION \ + openrc \ + bash + RUN rc-update add docker boot -COPY docker-setup / -RUN chmod +x /docker-setup +COPY docker-setup /bin/ +RUN chmod +x /bin/docker-setup -CMD [ "/docker-setup" ] +CMD [ "/bin/docker-setup" ] ENTRYPOINT [ "/bin/bash", "-l", "-c" ]