Dockerhub Multiarch Build #80
8 changed files with 30 additions and 121 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
# Custom build script to build images for all supported architectures.
|
# Custom build script to build images for all supported architectures.
|
||||||
# Example for IMAGE_NAME: ckulka/baikal:apache
|
# Example for IMAGE_NAME: ckulka/baikal:apache
|
||||||
|
|
||||||
for arch in amd64 arm32v5 arm32v7 arm64v8
|
for arch in amd64 arm32v7 arm64v8
|
||||||
do
|
do
|
||||||
echo "Building $IMAGE_NAME-$arch"
|
echo "Building $IMAGE_NAME-$arch"
|
||||||
docker build --build-arg FROM_ARCH=$arch --file $DOCKERFILE_PATH --tag $IMAGE_NAME-$arch .
|
docker build --build-arg FROM_ARCH=$arch --file $DOCKERFILE_PATH --tag $IMAGE_NAME-$arch .
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,33 @@
|
||||||
|
|
||||||
# Use manifest-tool to create the manifest, given the experimental
|
# Use manifest-tool to create the manifest, given the experimental
|
||||||
# "docker manifest" command isn't available yet on Docker Hub.
|
# "docker manifest" command isn't available yet on Docker Hub.
|
||||||
|
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64
|
||||||
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
|
|
||||||
chmod +x manifest-tool
|
chmod +x manifest-tool
|
||||||
|
|
||||||
./manifest-tool push from-spec multi-arch-manifest.yaml
|
# Generate the manifest file.
|
||||||
|
# Parameter 1 is the multi-arch image name, e.g. ckulka/baikal:0.5.1
|
||||||
|
# Parameter 2 is the base-image for the variants, e.g. ckulka/baikal:0.5.1-apache
|
||||||
|
function generate_manifest {
|
||||||
|
cat > manifest-generated.yaml << EOF
|
||||||
|
image: $1
|
||||||
|
manifests:
|
||||||
|
- image: $2-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
- image: $2-arm32v7
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
- image: $2-arm64v8
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Pushing multi-arch manifest $IMAGE_NAME"
|
||||||
|
generate_manifest $IMAGE_NAME $IMAGE_NAME
|
||||||
|
./manifest-tool push from-spec manifest-generated.yaml
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Custom build script to push images for all supported architectures.
|
# Custom build script to push images for all supported architectures.
|
||||||
|
|
||||||
for arch in amd64 arm32v5 arm32v7 arm64v8
|
for arch in amd64 arm32v7 arm64v8
|
||||||
do
|
do
|
||||||
echo "Pushing $IMAGE_NAME-$arch"
|
echo "Pushing $IMAGE_NAME-$arch"
|
||||||
docker push $IMAGE_NAME-$arch
|
docker push $IMAGE_NAME-$arch
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
image: bmartin5692/bumper:multiarch
|
|
||||||
manifests:
|
|
||||||
- image: bmartin5692/bumper:multiarch-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: linux
|
|
||||||
- image: bmartin5692/bumper:multiarch-arm32v5
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v5
|
|
||||||
- image: bmartin5692/bumper:multiarch-arm32v7
|
|
||||||
platform:
|
|
||||||
architecture: arm
|
|
||||||
os: linux
|
|
||||||
variant: v7
|
|
||||||
- image: bmartin5692/bumper:multiarch-arm64v8
|
|
||||||
platform:
|
|
||||||
architecture: arm64
|
|
||||||
os: linux
|
|
||||||
variant: v8
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
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"]
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
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"]
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
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"]
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
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"]
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue