Commit 8dcb62d1 authored by Christian's avatar Christian 💬

Update .gitlab-ci.yml, build.sh, Dockerfile, scripts/bootstrapper.sh files

parent d8534e62
stages:
- deploy
......@@ -8,25 +7,37 @@ variables:
rootfssha256sum: "f2b79ce732c0fd47a65bda6c51c9bef7d9d9037bd483037edafab722843b50cd"
pushtag: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${imageversion}"
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"
#
# -> Templates
#
deploy:
stage: deploy
.tpl:default:
image: debian:stable-slim
only:
- tags
- 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}"
after_script:
- "docker logout ${CI_REGISTRY}"
- "docker image prune -a -f"
#
# -> Jobs
#
deploy:
stage: deploy
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}"
......@@ -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", "--" ]
#!/usr/bin/env bash
#!/bin/bash
function build() {
local ARGROOTFSTAR=$1
......@@ -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"
}
......@@ -24,7 +24,7 @@ cd "$(dirname "$0")"
#-> arguments
ROOTFSTAR=""
IMAGENAME="brickburg-stretchbase:2.2"
IMAGENAME="brickburg-stretchbase:1.0"
while [[ $# -ge 1 ]]
do
......@@ -50,4 +50,4 @@ fi
build "$ROOTFSTAR" "$IMAGENAME"
flatimage "$IMAGENAME"
exit 0
exit 0
\ No newline at end of file
#!/usr/bin/env bash
#!/bin/bash
source "$(dirname "$0")/constants.sh"
# change apt lists
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment