Loading .gitlab-ci.yml +25 −14 Original line number Diff line number Diff line stages: - deploy Loading @@ -8,25 +7,37 @@ variables: rootfssha256sum: "f2b79ce732c0fd47a65bda6c51c9bef7d9d9037bd483037edafab722843b50cd" pushtag: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${imageversion}" # # -> Templates # .tpl:default: image: debian:stable-slim only: - schedules - web tags: - docker .tpl:docker: extends: .tpl:default image: docker:stable before_script: - "docker login -u gitlab-ci-token -p $CI_JOB_TOKEN ${CI_REGISTRY}" - 'curl "${rootfsurl}" > rootfs.tar.gz' - 'echo "${rootfssha256sum} rootfs.tar.gz" | sha256sum -c &> /dev/null || exit 98' - 'chmod a+x build.sh' after_script: - 'rm -f rootfs.tar.gz' - "docker logout ${CI_REGISTRY}" - "docker image prune -a -f" # # -> Jobs # deploy: stage: deploy only: - tags - schedules - web tags: - docker script: - 'curl "${rootfsurl}" > rootfs.tar.gz' - 'echo "${rootfssha256sum} rootfs.tar.gz" | sha256sum -c &> /dev/null || exit 98' - 'chmod a+x build.sh' - "./build.sh --rootfstarfile rootfs.tar.gz --imagename ${pushtag}" - 'rm -f rootfs.tar.gz' - "docker push ${pushtag}" Dockerfile +5 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,13 @@ FROM scratch ARG tarball ADD $tarball / # add tini ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini-amd64 /tini # add scripts and do bootstrap ADD scripts/ /scripts/ RUN chmod a+x /scripts/*.sh && \ chmod a+x /tini && \ /scripts/bootstrapper.sh ENTRYPOINT [ "/startup.sh" ] ENTRYPOINT [ "/tini", "-v", "--" ] build.sh +4 −4 Original line number Diff line number Diff line #!/usr/bin/env bash #!/bin/bash function build() { local ARGROOTFSTAR=$1 Loading @@ -16,7 +16,7 @@ function flatimage() { docker export "$TEMPEXNAME" > "$TEMPEX" docker rm "$TEMPEXNAME" docker image rm "$SRC" cat "$TEMPEX" | docker import --change "ENTRYPOINT [ \"/startup.sh\" ]" - "$SRC" cat "$TEMPEX" | docker import --change "ENTRYPOINT [ \"/tini\", \"-v\", \"--\" ]" - "$SRC" rm "$TEMPEX" } Loading @@ -24,7 +24,7 @@ cd "$(dirname "$0")" #-> arguments ROOTFSTAR="" IMAGENAME="brickburg-stretchbase:2.2" IMAGENAME="brickburg-stretchbase:1.0" while [[ $# -ge 1 ]] do Loading scripts/bootstrapper.sh +2 −13 Original line number Diff line number Diff line #!/usr/bin/env bash #!/bin/bash source "$(dirname "$0")/constants.sh" # change apt lists Loading Loading @@ -55,18 +56,6 @@ sed -e '/USE_DPKG/ s/^#//' -i /etc/locale.nopurge unlink /etc/localtime ln -s "/usr/share/zoneinfo/Europe/Berlin" /etc/localtime # add fake startup script cat > /startup.sh <<'EOF' #!/usr/bin/env bash while true do sleep 1 done exit 0 EOF chmod a+x /startup.sh # cleanup apt $(dirname "$0")/finalcleanup.sh --headless 2> /dev/null cd /; rm "$0"; exit 0 No newline at end of file Loading
.gitlab-ci.yml +25 −14 Original line number Diff line number Diff line stages: - deploy Loading @@ -8,25 +7,37 @@ variables: rootfssha256sum: "f2b79ce732c0fd47a65bda6c51c9bef7d9d9037bd483037edafab722843b50cd" pushtag: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${imageversion}" # # -> Templates # .tpl:default: image: debian:stable-slim only: - schedules - web tags: - docker .tpl:docker: extends: .tpl:default image: docker:stable before_script: - "docker login -u gitlab-ci-token -p $CI_JOB_TOKEN ${CI_REGISTRY}" - 'curl "${rootfsurl}" > rootfs.tar.gz' - 'echo "${rootfssha256sum} rootfs.tar.gz" | sha256sum -c &> /dev/null || exit 98' - 'chmod a+x build.sh' after_script: - 'rm -f rootfs.tar.gz' - "docker logout ${CI_REGISTRY}" - "docker image prune -a -f" # # -> Jobs # deploy: stage: deploy only: - tags - schedules - web tags: - docker script: - 'curl "${rootfsurl}" > rootfs.tar.gz' - 'echo "${rootfssha256sum} rootfs.tar.gz" | sha256sum -c &> /dev/null || exit 98' - 'chmod a+x build.sh' - "./build.sh --rootfstarfile rootfs.tar.gz --imagename ${pushtag}" - 'rm -f rootfs.tar.gz' - "docker push ${pushtag}"
Dockerfile +5 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,13 @@ FROM scratch ARG tarball ADD $tarball / # add tini ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini-amd64 /tini # add scripts and do bootstrap ADD scripts/ /scripts/ RUN chmod a+x /scripts/*.sh && \ chmod a+x /tini && \ /scripts/bootstrapper.sh ENTRYPOINT [ "/startup.sh" ] ENTRYPOINT [ "/tini", "-v", "--" ]
build.sh +4 −4 Original line number Diff line number Diff line #!/usr/bin/env bash #!/bin/bash function build() { local ARGROOTFSTAR=$1 Loading @@ -16,7 +16,7 @@ function flatimage() { docker export "$TEMPEXNAME" > "$TEMPEX" docker rm "$TEMPEXNAME" docker image rm "$SRC" cat "$TEMPEX" | docker import --change "ENTRYPOINT [ \"/startup.sh\" ]" - "$SRC" cat "$TEMPEX" | docker import --change "ENTRYPOINT [ \"/tini\", \"-v\", \"--\" ]" - "$SRC" rm "$TEMPEX" } Loading @@ -24,7 +24,7 @@ cd "$(dirname "$0")" #-> arguments ROOTFSTAR="" IMAGENAME="brickburg-stretchbase:2.2" IMAGENAME="brickburg-stretchbase:1.0" while [[ $# -ge 1 ]] do Loading
scripts/bootstrapper.sh +2 −13 Original line number Diff line number Diff line #!/usr/bin/env bash #!/bin/bash source "$(dirname "$0")/constants.sh" # change apt lists Loading Loading @@ -55,18 +56,6 @@ sed -e '/USE_DPKG/ s/^#//' -i /etc/locale.nopurge unlink /etc/localtime ln -s "/usr/share/zoneinfo/Europe/Berlin" /etc/localtime # add fake startup script cat > /startup.sh <<'EOF' #!/usr/bin/env bash while true do sleep 1 done exit 0 EOF chmod a+x /startup.sh # cleanup apt $(dirname "$0")/finalcleanup.sh --headless 2> /dev/null cd /; rm "$0"; exit 0 No newline at end of file