Fix broken support for version >3.x

There were some changes in build pipeline in just-containers/s6-overlay:

- AMD64 has been replaced with multi-arch x84_64

- File name now includes version number

- Archive is now xz compressed

Changes:

- Dockerfile for v2 is now legacy and is split into Dockerfile.legacy

- Dockerfile for v3 is now Dockerfile and has different process
This commit is contained in:
Aleksandar Puharic 2022-01-30 04:03:56 +01:00
parent 8bded454e1
commit 0b8a5a5d81
Signed by: xZero707
GPG Key ID: 3CC53DCAA9C237BB
3 changed files with 68 additions and 24 deletions

View File

@ -1,18 +1,35 @@
# First stage - Download s6-overlay
ARG DOWNLOADER_ALPINE_VERSION=3.15
# First stage - Download s6-overlay and unpack it
FROM --platform=${TARGETPLATFORM} alpine:${DOWNLOADER_ALPINE_VERSION} AS downloader
ARG TARGETPLATFORM
# S6 Overlay
ARG S6_OVERLAY_VERSION="3.0.0.0-1"
ARG S6_OVERLAY_RELEASE="https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${TARGETPLATFORM}.tar.gz"
ARG S6_OVERLAY_RELEASE="https://github.com/just-containers/s6-overlay/releases/download/"
RUN wget -O /tmp/s6overlay.tar.gz $(echo ${S6_OVERLAY_RELEASE} | sed 's/linux\///g' | sed 's/arm64/aarch64/g' | sed 's/arm\/v7/armhf/g') \
&& mkdir -p /s6-overlay \
&& tar xzf /tmp/s6overlay.tar.gz -C /s6-overlay
# First stage - Download s6-overlay noarch base and unpack it
FROM scratch AS downloader-s6-base
ARG S6_OVERLAY_VERSION
ARG S6_OVERLAY_RELEASE
ADD "${S6_OVERLAY_RELEASE}/v${S6_OVERLAY_VERSION}/s6-overlay-noarch-${S6_OVERLAY_VERSION}.tar.xz" /s6overlay-base.tar.xz
# Second stage - Download s6-overlay platform-dependent binaries and unpack
FROM --platform=${TARGETPLATFORM} alpine:3.15 AS downloader-s6-bin
ARG TARGETPLATFORM
ARG S6_OVERLAY_VERSION
ARG S6_OVERLAY_RELEASE
ARG S6_OVERLAY_RELEASE_URL="${S6_OVERLAY_RELEASE}/v${S6_OVERLAY_VERSION}/s6-overlay-${TARGETPLATFORM}-${S6_OVERLAY_VERSION}.tar.xz"
RUN wget -O /s6overlay-bin.tar.xz "$(echo ${S6_OVERLAY_RELEASE_URL} | sed 's/linux\///g' | sed 's/amd64/x86_64/g' | sed 's/arm64/aarch64/g' | sed 's/arm\/v7/armhf/g')"
# Third stage - Build rootfs from s6 parts
FROM alpine:3.15 AS rootfs-builder
COPY --from=downloader-s6-base ["/s6overlay-base.tar.xz", "/s6overlay-base.tar.xz"]
COPY --from=downloader-s6-bin ["/s6overlay-bin.tar.xz", "/s6overlay-bin.tar.xz"]
WORKDIR "/rootfs-build/"
RUN apk add --no-cache tar xz \
&& tar -Jxpf /s6overlay-base.tar.xz -C /rootfs-build \
&& tar -Jxpf /s6overlay-bin.tar.xz -C /rootfs-build
# Final stage
@ -20,4 +37,4 @@ FROM scratch AS s6-rootfs
LABEL maintainer="Aleksandar Puharic <aleksandar@puharic.com>"
COPY --from=downloader ["/s6-overlay/", "/"]
COPY --from=rootfs-builder ["/rootfs-build/", "/"]

23
Dockerfile.legacy Normal file
View File

@ -0,0 +1,23 @@
# First stage - Download s6-overlay
ARG DOWNLOADER_ALPINE_VERSION=3.15
# First stage - Download s6-overlay and unpack it
FROM --platform=${TARGETPLATFORM} alpine:${DOWNLOADER_ALPINE_VERSION} AS downloader
ARG TARGETPLATFORM
# S6 Overlay
ARG S6_OVERLAY_VERSION="v2.2.0.3"
ARG S6_OVERLAY_RELEASE="https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${TARGETPLATFORM}.tar.gz"
RUN wget -O /tmp/s6overlay.tar.gz $(echo ${S6_OVERLAY_RELEASE} | sed 's/linux\///g' | sed 's/arm64/aarch64/g' | sed 's/arm\/v7/armhf/g') \
&& mkdir -p /s6-overlay \
&& tar xzf /tmp/s6overlay.tar.gz -C /s6-overlay
# Final stage
FROM scratch AS s6-rootfs
LABEL maintainer="Aleksandar Puharic <aleksandar@puharic.com>"
COPY --from=downloader ["/s6-overlay/", "/"]

View File

@ -6,6 +6,10 @@ target "build-dockerfile" {
dockerfile = "Dockerfile"
}
target "build-dockerfile-legacy" {
dockerfile = "Dockerfile.legacy"
}
target "build-platforms" {
platforms = ["linux/amd64", "linux/armhf", "linux/aarch64"]
}
@ -15,42 +19,42 @@ target "build-common" {
}
target "2.1.0.2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
inherits = ["build-dockerfile-legacy", "build-platforms", "build-common"]
tags = ["docker.io/nlss/s6-rootfs:2.1.0.2", "docker.io/nlss/s6-rootfs:2.1"]
args = {
S6_OVERLAY_VERSION = "v2.1.0.2"
S6_OVERLAY_VERSION = "2.1.0.2"
}
}
target "2.2.0.0" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
inherits = ["build-dockerfile-legacy", "build-platforms", "build-common"]
tags = ["docker.io/nlss/s6-rootfs:2.2.0.0"]
args = {
S6_OVERLAY_VERSION = "v2.2.0.0"
S6_OVERLAY_VERSION = "2.2.0.0"
}
}
target "2.2.0.1" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
inherits = ["build-dockerfile-legacy", "build-platforms", "build-common"]
tags = ["docker.io/nlss/s6-rootfs:2.2.0.1"]
args = {
S6_OVERLAY_VERSION = "v2.2.0.1"
S6_OVERLAY_VERSION = "2.2.0.1"
}
}
target "2.2.0.2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
inherits = ["build-dockerfile-legacy", "build-platforms", "build-common"]
tags = ["docker.io/nlss/s6-rootfs:2.2.0.2"]
args = {
S6_OVERLAY_VERSION = "v2.2.0.2"
S6_OVERLAY_VERSION = "2.2.0.2"
}
}
target "2.2.0.3" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
inherits = ["build-dockerfile-legacy", "build-platforms", "build-common"]
tags = ["docker.io/nlss/s6-rootfs:2.2.0.3", "docker.io/nlss/s6-rootfs:2.2"]
args = {
S6_OVERLAY_VERSION = "v2.2.0.3"
S6_OVERLAY_VERSION = "2.2.0.3"
}
}