From 8e93fcdcce22735580efd297b0eb786e677a5208 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 3 Jan 2021 20:53:56 +0100 Subject: [PATCH] chore(docker): use standalone dockerfiles for multiarch --- .drone.jsonnet | 6 +++--- .drone.yml | 20 ++++++++++---------- bin/git-batch | 7 ------- docker/Dockerfile | 24 ------------------------ docker/Dockerfile.amd64 | 25 +++++++++++++++++++++++++ docker/Dockerfile.arm | 25 +++++++++++++++++++++++++ docker/Dockerfile.arm64 | 25 +++++++++++++++++++++++++ 7 files changed, 88 insertions(+), 44 deletions(-) delete mode 100755 bin/git-batch delete mode 100644 docker/Dockerfile create mode 100644 docker/Dockerfile.amd64 create mode 100644 docker/Dockerfile.arm create mode 100644 docker/Dockerfile.arm64 diff --git a/.drone.jsonnet b/.drone.jsonnet index 7b868cf..1319ff8 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -209,7 +209,7 @@ local PipelineBuildContainer(arch='amd64') = { settings: { config: { from_secret: 'docker_config' }, dry_run: true, - dockerfile: 'docker/Dockerfile', + dockerfile: 'docker/Dockerfile.' + arch, repo: 'thegeeklab/git-batch', username: { from_secret: 'docker_username' }, password: { from_secret: 'docker_password' }, @@ -226,7 +226,7 @@ local PipelineBuildContainer(arch='amd64') = { config: { from_secret: 'docker_config' }, auto_tag: true, auto_tag_suffix: arch, - dockerfile: 'docker/Dockerfile', + dockerfile: 'docker/Dockerfile.' + arch, repo: 'thegeeklab/${DRONE_REPO_NAME}', username: { from_secret: 'docker_username' }, password: { from_secret: 'docker_password' }, @@ -243,7 +243,7 @@ local PipelineBuildContainer(arch='amd64') = { config: { from_secret: 'docker_config' }, auto_tag: true, auto_tag_suffix: arch, - dockerfile: 'docker/Dockerfile', + dockerfile: 'docker/Dockerfile.' + arch, registry: 'quay.io', repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}', username: { from_secret: 'quay_username' }, diff --git a/.drone.yml b/.drone.yml index d69c09d..c0cc99e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -233,7 +233,7 @@ steps: settings: config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.amd64 dry_run: true password: from_secret: docker_password @@ -253,7 +253,7 @@ steps: auto_tag_suffix: amd64 config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.amd64 password: from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME} @@ -273,7 +273,7 @@ steps: auto_tag_suffix: amd64 config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.amd64 password: from_secret: quay_password registry: quay.io @@ -322,7 +322,7 @@ steps: settings: config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm64 dry_run: true password: from_secret: docker_password @@ -342,7 +342,7 @@ steps: auto_tag_suffix: arm64 config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm64 password: from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME} @@ -362,7 +362,7 @@ steps: auto_tag_suffix: arm64 config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm64 password: from_secret: quay_password registry: quay.io @@ -411,7 +411,7 @@ steps: settings: config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm dry_run: true password: from_secret: docker_password @@ -431,7 +431,7 @@ steps: auto_tag_suffix: arm config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm password: from_secret: docker_password repo: thegeeklab/${DRONE_REPO_NAME} @@ -451,7 +451,7 @@ steps: auto_tag_suffix: arm config: from_secret: docker_config - dockerfile: docker/Dockerfile + dockerfile: docker/Dockerfile.arm password: from_secret: quay_password registry: quay.io @@ -575,6 +575,6 @@ depends_on: --- kind: signature -hmac: 4e584a0541cf28a67c24b61a955fcfeacd37a768a8f99f280b1dc572501fe5d3 +hmac: 595b9f73481481804eb918efee5275483a9b3d147e0d3ac6b70e49a844f11c90 ... diff --git a/bin/git-batch b/bin/git-batch deleted file mode 100755 index c40dff2..0000000 --- a/bin/git-batch +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -import gitbatch.__main__ - -sys.exit(gitbatch.__main__.main()) diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 7501926..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM python:3.9-alpine - -LABEL maintainer="Robert Kaussow " \ - org.label-schema.name="git-batch" \ - org.label-schema.vcs-url="https://github.com/thegeeklab/git-batch" \ - org.label-schema.vendor="Robert Kaussow" \ - org.label-schema.schema-version="1.0" - -ENV PY_COLORS=1 - -ADD dist/git_batch-*.whl / - -RUN apk --update add --virtual .build-deps build-base libffi-dev libressl-dev && \ - apk --update add git && \ - pip install --upgrade --no-cache-dir pip && \ - pip install --no-cache-dir git_batch-*.whl && \ - apk del .build-deps && \ - rm -f git_batch-*.whl && \ - rm -rf /var/cache/apk/* && \ - rm -rf /root/.cache/ - -USER root -CMD [] -ENTRYPOINT ["/usr/local/bin/git-batch"] diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64 new file mode 100644 index 0000000..2b19909 --- /dev/null +++ b/docker/Dockerfile.amd64 @@ -0,0 +1,25 @@ +FROM amd64/python:3.9-alpine + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="git-batch" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/git-batch" + +ENV PY_COLORS=1 + +ADD dist/git_batch-*.whl / + +RUN apk --update add --virtual .build-deps build-base libffi-dev libressl-dev && \ + apk --update add git && \ + pip install --upgrade --no-cache-dir pip && \ + pip install --no-cache-dir $(find / -name "git_batch-*.whl") && \ + apk del .build-deps && \ + rm -f git_batch-*.whl && \ + rm -rf /var/cache/apk/* && \ + rm -rf /root/.cache/ + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/git-batch"] diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm new file mode 100644 index 0000000..2baae0e --- /dev/null +++ b/docker/Dockerfile.arm @@ -0,0 +1,25 @@ +FROM arm32v7/python:3.9-alpine + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="git-batch" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/git-batch" + +ENV PY_COLORS=1 + +ADD dist/git_batch-*.whl / + +RUN apk --update add --virtual .build-deps build-base libffi-dev libressl-dev && \ + apk --update add git && \ + pip install --upgrade --no-cache-dir pip && \ + pip install --no-cache-dir $(find / -name "git_batch-*.whl") && \ + apk del .build-deps && \ + rm -f git_batch-*.whl && \ + rm -rf /var/cache/apk/* && \ + rm -rf /root/.cache/ + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/git-batch"] diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 0000000..30a0758 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,25 @@ +FROM arm64v8/python:3.9-alpine + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="git-batch" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/git-batch" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/git-batch" + +ENV PY_COLORS=1 + +ADD dist/git_batch-*.whl / + +RUN apk --update add --virtual .build-deps build-base libffi-dev libressl-dev && \ + apk --update add git && \ + pip install --upgrade --no-cache-dir pip && \ + pip install --no-cache-dir $(find / -name "git_batch-*.whl") && \ + apk del .build-deps && \ + rm -f git_batch-*.whl && \ + rm -rf /var/cache/apk/* && \ + rm -rf /root/.cache/ + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/git-batch"]