From 8369f6305b74065890e4b4d60bbb2c3fc517fc36 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 10 Jan 2021 15:50:58 +0100 Subject: [PATCH] test multiarch --- .drone.jsonnet | 8 ++++++-- .drone.yml | 23 ++++++++++++++------- Dockerfile.amd64 | 40 ++++++++++++++++++++++++++++++++++++ Dockerfile => Dockerfile.arm | 2 +- Dockerfile.arm64 | 40 ++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 10 deletions(-) create mode 100644 Dockerfile.amd64 rename Dockerfile => Dockerfile.arm (95%) create mode 100644 Dockerfile.arm64 diff --git a/.drone.jsonnet b/.drone.jsonnet index eded99e..6c1d7d5 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -42,8 +42,11 @@ local PipelineBuildContainer(arch='amd64') = { image: 'jdrouet/docker-with-buildx:stable', commands: [ 'docker buildx create --use', - 'docker buildx build --platform linux/' + std.strReplace(arch, '_', '/') + ' --tag thegeeklab/buildx-alpine:latest .', + 'docker buildx build --platform linux/' + std.strReplace(arch, '_', '/') + ' --tag thegeeklab/buildx-alpine:latest . -f ${DOCKERFILE}', ], + environment: { + DOCKERFILE: 'Dockerfile.' + std.split(arch, '_')[0], + }, volumes: [{ name: 'dockersock-' + arch, path: '/var/run', @@ -73,11 +76,12 @@ local PipelineBuildContainer(arch='amd64') = { commands: [ 'docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"', 'docker buildx create --use', - 'docker buildx build --push --platform linux/' + std.strReplace(arch, '_', '/') + ' --tag thegeeklab/buildx-alpine:' + std.split(arch, '_')[0] + ' .', + 'docker buildx build --push --platform linux/' + std.strReplace(arch, '_', '/') + ' --tag thegeeklab/buildx-alpine:' + std.split(arch, '_')[0] + ' . -f ${DOCKERFILE}', ], environment: { DOCKER_PASSWORD: { from_secret: 'docker_password' }, DOCKER_USERNAME: { from_secret: 'docker_username' }, + DOCKERFILE: 'Dockerfile.' + std.split(arch, '_')[0], }, volumes: [{ name: 'dockersock-' + arch, diff --git a/.drone.yml b/.drone.yml index 855f1a7..2cb605b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,7 +38,9 @@ steps: image: jdrouet/docker-with-buildx:stable commands: - docker buildx create --use - - docker buildx build --platform linux/amd64 --tag thegeeklab/buildx-alpine:latest . + - docker buildx build --platform linux/amd64 --tag thegeeklab/buildx-alpine:latest . -f ${DOCKERFILE} + environment: + DOCKERFILE: Dockerfile.amd64 volumes: - name: dockersock-amd64 path: /var/run @@ -67,8 +69,9 @@ steps: commands: - docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD" - docker buildx create --use - - docker buildx build --push --platform linux/amd64 --tag thegeeklab/buildx-alpine:amd64 . + - docker buildx build --push --platform linux/amd64 --tag thegeeklab/buildx-alpine:amd64 . -f ${DOCKERFILE} environment: + DOCKERFILE: Dockerfile.amd64 DOCKER_PASSWORD: from_secret: docker_password DOCKER_USERNAME: @@ -124,7 +127,9 @@ steps: image: jdrouet/docker-with-buildx:stable commands: - docker buildx create --use - - docker buildx build --platform linux/arm64/v8 --tag thegeeklab/buildx-alpine:latest . + - docker buildx build --platform linux/arm64/v8 --tag thegeeklab/buildx-alpine:latest . -f ${DOCKERFILE} + environment: + DOCKERFILE: Dockerfile.arm64 volumes: - name: dockersock-arm64_v8 path: /var/run @@ -153,8 +158,9 @@ steps: commands: - docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD" - docker buildx create --use - - docker buildx build --push --platform linux/arm64/v8 --tag thegeeklab/buildx-alpine:arm64 . + - docker buildx build --push --platform linux/arm64/v8 --tag thegeeklab/buildx-alpine:arm64 . -f ${DOCKERFILE} environment: + DOCKERFILE: Dockerfile.arm64 DOCKER_PASSWORD: from_secret: docker_password DOCKER_USERNAME: @@ -210,7 +216,9 @@ steps: image: jdrouet/docker-with-buildx:stable commands: - docker buildx create --use - - docker buildx build --platform linux/arm/v7 --tag thegeeklab/buildx-alpine:latest . + - docker buildx build --platform linux/arm/v7 --tag thegeeklab/buildx-alpine:latest . -f ${DOCKERFILE} + environment: + DOCKERFILE: Dockerfile.arm volumes: - name: dockersock-arm_v7 path: /var/run @@ -239,8 +247,9 @@ steps: commands: - docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD" - docker buildx create --use - - docker buildx build --push --platform linux/arm/v7 --tag thegeeklab/buildx-alpine:arm . + - docker buildx build --push --platform linux/arm/v7 --tag thegeeklab/buildx-alpine:arm . -f ${DOCKERFILE} environment: + DOCKERFILE: Dockerfile.arm DOCKER_PASSWORD: from_secret: docker_password DOCKER_USERNAME: @@ -349,6 +358,6 @@ depends_on: --- kind: signature -hmac: 76e555af40a68c0e75b0fcb3a67ec222aa8ac8034baf2787a753323fb4a0f58c +hmac: 6f2c42e32ff8a7cae90d34ed880c480d31557f7dc7f796fbae9f133b1de9e246 ... diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 new file mode 100644 index 0000000..faf43cd --- /dev/null +++ b/Dockerfile.amd64 @@ -0,0 +1,40 @@ +FROM amd64/alpine:3.12@sha256:074d3636ebda6dd446d0d00304c4454f468237fdacf08fb0eeac90bdbfa1bac7 + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="alpine" +LABEL org.opencontainers.image.url="https://gitea.rknet.org/docker/alpine" +LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/alpine" +LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/alpine" + +ARG GOMPLATE_VERSION +ARG SUPERCRONIC_VERSION +ARG URL_PARSER_VERSION + +# renovate: datasource=github-releases depName=hairyhenderson/gomplate +ENV GOMPLATE_VERSION="${GOMPLATE_VERSION:-v3.8.0}" +# renovate: datasource=github-releases depName=aptible/supercronic +ENV SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION:-v0.1.12}" +# renovate: datasource=github-releases depName=thegeeklab/url-parser +ENV URL_PARSER_VERSION="${URL_PARSER_VERSION:-v0.2.1}" + +RUN addgroup -g 101 -S app && \ + adduser -S -D -H -u 101 -h /app -s /sbin/nologin -G app -g app app && \ + apk --update add --virtual .build-deps curl && \ + curl -SsL -o /usr/local/bin/gomplate "https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-amd64-slim" && \ + curl -SsL -o /usr/local/bin/supercronic "https://github.com/aptible/supercronic/releases/download/${SUPERCRONIC_VERSION}/supercronic-linux-amd64" && \ + curl -SsL -o /usr/local/bin/url-parser "https://github.com/thegeeklab/url-parser/releases/download/${URL_PARSER_VERSION}/url-parser-linux-amd64" && \ + curl -SsL -o /usr/local/bin/wait-for "https://raw.githubusercontent.com/thegeeklab/wait-for/master/wait-for" && \ + chmod 755 /usr/local/bin/gomplate && \ + chmod 755 /usr/local/bin/supercronic && \ + chmod 755 /usr/local/bin/url-parser && \ + chmod 755 /usr/local/bin/wait-for && \ + apk del .build-deps && \ + rm -rf /var/cache/apk/* && \ + rm -rf /tmp/* + +ADD overlay/ / + +STOPSIGNAL SIGTERM + +CMD [] diff --git a/Dockerfile b/Dockerfile.arm similarity index 95% rename from Dockerfile rename to Dockerfile.arm index 5631d49..1312c2b 100644 --- a/Dockerfile +++ b/Dockerfile.arm @@ -1,4 +1,4 @@ -FROM alpine:3.12@sha256:074d3636ebda6dd446d0d00304c4454f468237fdacf08fb0eeac90bdbfa1bac7 +FROM arm32v7/alpine:3.12 LABEL maintainer="Robert Kaussow " LABEL org.opencontainers.image.authors="Robert Kaussow " diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 new file mode 100644 index 0000000..b8183f1 --- /dev/null +++ b/Dockerfile.arm64 @@ -0,0 +1,40 @@ +FROM arm64v8/alpine:3.12 + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="alpine" +LABEL org.opencontainers.image.url="https://gitea.rknet.org/docker/alpine" +LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/alpine" +LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/alpine" + +ARG GOMPLATE_VERSION +ARG SUPERCRONIC_VERSION +ARG URL_PARSER_VERSION + +# renovate: datasource=github-releases depName=hairyhenderson/gomplate +ENV GOMPLATE_VERSION="${GOMPLATE_VERSION:-v3.8.0}" +# renovate: datasource=github-releases depName=aptible/supercronic +ENV SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION:-v0.1.12}" +# renovate: datasource=github-releases depName=thegeeklab/url-parser +ENV URL_PARSER_VERSION="${URL_PARSER_VERSION:-v0.2.1}" + +RUN addgroup -g 101 -S app && \ + adduser -S -D -H -u 101 -h /app -s /sbin/nologin -G app -g app app && \ + apk --update add --virtual .build-deps curl && \ + curl -SsL -o /usr/local/bin/gomplate "https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-amd64-slim" && \ + curl -SsL -o /usr/local/bin/supercronic "https://github.com/aptible/supercronic/releases/download/${SUPERCRONIC_VERSION}/supercronic-linux-amd64" && \ + curl -SsL -o /usr/local/bin/url-parser "https://github.com/thegeeklab/url-parser/releases/download/${URL_PARSER_VERSION}/url-parser-linux-amd64" && \ + curl -SsL -o /usr/local/bin/wait-for "https://raw.githubusercontent.com/thegeeklab/wait-for/master/wait-for" && \ + chmod 755 /usr/local/bin/gomplate && \ + chmod 755 /usr/local/bin/supercronic && \ + chmod 755 /usr/local/bin/url-parser && \ + chmod 755 /usr/local/bin/wait-for && \ + apk del .build-deps && \ + rm -rf /var/cache/apk/* && \ + rm -rf /tmp/* + +ADD overlay/ / + +STOPSIGNAL SIGTERM + +CMD []