From e286305362a702d1e183257cd590109244e2a212 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 14 Jan 2022 21:54:59 +0100 Subject: [PATCH] Initial commit --- .github/workflows/image.yml | 35 +++++++++++++++++++++++ Dockerfile | 23 ++++++++++++++++ README.md | 1 + build/bin/build | 3 ++ build/docker-bake.hcl | 55 +++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+) create mode 100644 .github/workflows/image.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 build/bin/build create mode 100644 build/docker-bake.hcl diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..de9f942 --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,35 @@ +name: Build docker s6-overlay rootfs image + +on: + push: + branches: master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: Cache Docker layers + uses: actions/cache@v2 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + config-inline: | + [worker.oci] + max-parallelism = 16 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build image + run: build/bin/build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe3ede3 --- /dev/null +++ b/Dockerfile @@ -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 " + +COPY --from=downloader ["/s6-overlay/", "/"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..63b8ccf --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +### S6-overlay rootfs diff --git a/build/bin/build b/build/bin/build new file mode 100755 index 0000000..da63117 --- /dev/null +++ b/build/bin/build @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker buildx bake --push --file build/docker-bake.hcl \ No newline at end of file diff --git a/build/docker-bake.hcl b/build/docker-bake.hcl new file mode 100644 index 0000000..08c5eb0 --- /dev/null +++ b/build/docker-bake.hcl @@ -0,0 +1,55 @@ +group "default" { + targets = ["2.1.0.2", "2.2.0.0", "2.2.0.1", "2.2.0.2", "2.2.0.3"] +} + +target "build-dockerfile" { + dockerfile = "Dockerfile" +} + +target "build-platforms" { + platforms = ["linux/amd64", "linux/armhf", "linux/aarch64"] +} + +target "build-common" { + pull = true +} + +target "2.1.0.2" { + inherits = ["build-dockerfile", "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" + } +} + +target "2.2.0.0" { + inherits = ["build-dockerfile", "build-platforms", "build-common"] + tags = ["docker.io/nlss/s6-rootfs:2.2.0.0"] + args = { + S6_OVERLAY_VERSION = "v2.2.0.0" + } +} + +target "2.2.0.1" { + inherits = ["build-dockerfile", "build-platforms", "build-common"] + tags = ["docker.io/nlss/s6-rootfs:2.2.0.1"] + args = { + S6_OVERLAY_VERSION = "v2.2.0.1" + } +} + +target "2.2.0.2" { + inherits = ["build-dockerfile", "build-platforms", "build-common"] + tags = ["docker.io/nlss/s6-rootfs:2.2.0.2"] + args = { + S6_OVERLAY_VERSION = "v2.2.0.2" + } +} + +target "2.2.0.3" { + inherits = ["build-dockerfile", "build-platforms", "build-common"] + tags = ["docker.io/nlss/s6-rootfs:2.2.0.3", "docker.io/nlss/s6-rootfs:2.2", "docker.io/nlss/s6-rootfs:latest"] + args = { + S6_OVERLAY_VERSION = "v2.2.0.3" + } +}