From 4f820ebce8b10575ab23b9963f8dd40be7ed907e Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Tue, 31 Dec 2019 14:11:22 -0500 Subject: [PATCH] add hooks and dockerfiles add hooks and dockerfiles --- amd64.dockerfile | 17 +++++++++++++++++ arm32v5.dockerfile | 26 ++++++++++++++++++++++++++ arm32v7.dockerfile | 26 ++++++++++++++++++++++++++ arm64v8.dockerfile | 26 ++++++++++++++++++++++++++ hooks/post_push | 9 +++++++++ hooks/pre_build | 5 +++++ 6 files changed, 109 insertions(+) create mode 100644 amd64.dockerfile create mode 100644 arm32v5.dockerfile create mode 100644 arm32v7.dockerfile create mode 100644 arm64v8.dockerfile create mode 100644 hooks/post_push create mode 100644 hooks/pre_build diff --git a/amd64.dockerfile b/amd64.dockerfile new file mode 100644 index 0000000..4797b82 --- /dev/null +++ b/amd64.dockerfile @@ -0,0 +1,17 @@ +FROM amd64/python:3.7-alpine as base + +FROM base as builder + +# add build utils (gcc, others) +RUN apk add build-base + +FROM base + +COPY . /bumper + +WORKDIR /bumper + +# install required python packages +RUN pip3 install -r requirements.txt + +ENTRYPOINT ["python3", "-m", "bumper"] diff --git a/arm32v5.dockerfile b/arm32v5.dockerfile new file mode 100644 index 0000000..c6736b5 --- /dev/null +++ b/arm32v5.dockerfile @@ -0,0 +1,26 @@ +FROM alpine as builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + +FROM arm32v5/python:3.7-alpine as base + +# Add QEMU +COPY --from=builder qemu-arm-static /usr/bin + +FROM base as builder + +# add build utils (gcc, others) +RUN apk add build-base + +FROM base + +COPY . /bumper + +WORKDIR /bumper + +# install required python packages +RUN pip3 install -r requirements.txt + +ENTRYPOINT ["python3", "-m", "bumper"] diff --git a/arm32v7.dockerfile b/arm32v7.dockerfile new file mode 100644 index 0000000..a977d51 --- /dev/null +++ b/arm32v7.dockerfile @@ -0,0 +1,26 @@ +FROM alpine as builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + +FROM arm32v7/python:3.7-alpine as base + +# Add QEMU +COPY --from=builder qemu-arm-static /usr/bin + +FROM base as builder + +# add build utils (gcc, others) +RUN apk add build-base + +FROM base + +COPY . /bumper + +WORKDIR /bumper + +# install required python packages +RUN pip3 install -r requirements.txt + +ENTRYPOINT ["python3", "-m", "bumper"] diff --git a/arm64v8.dockerfile b/arm64v8.dockerfile new file mode 100644 index 0000000..a540ec0 --- /dev/null +++ b/arm64v8.dockerfile @@ -0,0 +1,26 @@ +FROM alpine as builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-aarch64.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + +FROM arm64v8/python:3.7-alpine as base + +# Add QEMU +COPY --from=builder qemu-aarch64-static /usr/bin + +FROM base as builder + +# add build utils (gcc, others) +RUN apk add build-base + +FROM base + +COPY . /bumper + +WORKDIR /bumper + +# install required python packages +RUN pip3 install -r requirements.txt + +ENTRYPOINT ["python3", "-m", "bumper"] diff --git a/hooks/post_push b/hooks/post_push new file mode 100644 index 0000000..dc4c90a --- /dev/null +++ b/hooks/post_push @@ -0,0 +1,9 @@ +#!/bin/bash + +# Use manifest-tool to create the manifest, given the experimental +# "docker manifest" command isn't available yet on Docker Hub. + +curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64 +chmod +x manifest-tool + +./manifest-tool push from-spec multi-arch-manifest.yaml \ No newline at end of file diff --git a/hooks/pre_build b/hooks/pre_build new file mode 100644 index 0000000..d5a811d --- /dev/null +++ b/hooks/pre_build @@ -0,0 +1,5 @@ +#!/bin/bash + +# Register qemu-*-static for all supported processors except the +# current one, but also remove all registered binfmt_misc before +docker run --rm --privileged multiarch/qemu-user-static:register --reset \ No newline at end of file