Multiarch (#3)

* Add one Dockerfile for each supported architecture

* Update multi arch hooks

* Create multi arch scripts

* Update README.md

* WIP. Use build args instead of multiple Dockerfiles in build script

* WIP. Fix typo mistake

* Use build args instead of multiple Dockerfiles in build script

* WIP. Build all the architectures in one DockerHub build

* Add arm64v8 architecture

* WIP. Testing build all the architectures in one DockerHub build

* Revert "WIP. Testing build all the architectures in one DockerHub build"

This reverts commit 94a89398a4120b183d2851ac7cb9c93db0e3d187.

* Refactor tag docker images in hooks/post_push files

* Use variables instead of positional arguments

* Export externally used variables

* Use ${variable//search/replace} instead of echo $variable | sed.

* Update README.md

* Add Cleanup in build.sh script

* Fix tagging error in post_push hook

* Add "-ex" flags to bash script

* Test tagging images in build hook

* Tagging in hook/post_build instead of hook/post_push

* Push built architecture dependent image

* Use Dockerfile argument instead of fixed value

* Fix typo

* Use parameter instead of global variable

* Use custom "hook/push" to prevent duplicated push

* Make a short doctype for each function declared in common
This commit is contained in:
Oriol Teixidó
2019-10-11 17:07:45 +02:00
committed by Adrien Ferrand
parent 67fddae90d
commit e9a9a180bb
16 changed files with 273 additions and 48 deletions
+1
View File
@@ -0,0 +1 @@
qemu-*-static
+10 -2
View File
@@ -1,4 +1,12 @@
FROM certbot/certbot
# Docker Arch (amd64, arm32v6, ...)
ARG TARGET_ARCH
ARG CERTBOT_VERSION
FROM certbot/certbot:${TARGET_ARCH}-v${CERTBOT_VERSION}
# Qemu Arch (x86_64, arm, ...)
ARG QEMU_ARCH
ENV QEMU_ARCH=${QEMU_ARCH}
COPY qemu-${QEMU_ARCH}-static /usr/bin/
ARG PLUGIN_NAME
@@ -6,7 +14,7 @@ ARG PLUGIN_NAME
RUN wget -O certbot-${CERTBOT_VERSION}.tar.gz https://github.com/certbot/certbot/archive/v${CERTBOT_VERSION}.tar.gz \
&& tar xf certbot-${CERTBOT_VERSION}.tar.gz \
&& cp -r certbot-${CERTBOT_VERSION}/certbot-${PLUGIN_NAME} /opt/certbot/src/certbot-${PLUGIN_NAME} \
&& rm -rf certbot-${CERTBOT_VERSION}.tar.gz certbot-${CERTBOT_VERSION}
&& rm -rf certbot-${CERTBOT_VERSION}.tar.gz certbot-${CERTBOT_VERSION}
# Install the DNS plugin
RUN pip install --constraint /opt/certbot/docker_constraints.txt --no-cache-dir --editable /opt/certbot/src/certbot-${PLUGIN_NAME}
+8 -1
View File
@@ -1,5 +1,12 @@
#!/bin/bash
set -ex
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source "$WORK_DIR/../../lib/common"
CERTBOT_VERSION=$(GetCerbotVersionFromTag "$DOCKER_TAG")
PLUGIN_NAME=${DOCKER_REPO//*\//}
docker build --build-arg PLUGIN_NAME=${PLUGIN_NAME} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} .
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
BuildDockerPluginImage "${TARGET_ARCH}" "${CERTBOT_VERSION}" "${PLUGIN_NAME}"
done
+9 -2
View File
@@ -1,5 +1,12 @@
#!/bin/bash
set -ex
docker tag ${IMAGE_NAME} "${DOCKER_REPO}:latest"
docker push "${DOCKER_REPO}:latest"
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source "$WORK_DIR/../../lib/common"
CERTBOT_VERSION=$(GetCerbotVersionFromTag "$DOCKER_TAG")
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
TagDockerImageAliases "${TARGET_ARCH}" "${CERTBOT_VERSION}"
PushDockerImageAliases "${TARGET_ARCH}" "${CERTBOT_VERSION}"
done
+7 -2
View File
@@ -1,5 +1,10 @@
#!/bin/bash
set -ex
CERTBOT_VERSION=${DOCKER_TAG//v/}
docker build --build-arg CERTBOT_VERSION=${CERTBOT_VERSION} -f ../core/Dockerfile -t certbot/certbot ../core
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source "$WORK_DIR/../../lib/common"
RegisterQemuHandlers
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
DownloadQemuStatic "${TARGET_ARCH}"
done
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
set -ex
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source "$WORK_DIR/../../lib/common"
CERTBOT_VERSION=$(GetCerbotVersionFromTag "$DOCKER_TAG")
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
PushDockerImage "${TARGET_ARCH}" "${CERTBOT_VERSION}"
done