~mapperr/dockerfiles

9a9d3c452922a29e209beba2da15b108636cbdd4 — mapperr 6 months ago 496aebf
laminar: streamlined
3 files changed, 48 insertions(+), 2 deletions(-)

M laminarCI/Dockerfile
A laminarCI/build.sh
A laminarCI/entry.sh
M laminarCI/Dockerfile => laminarCI/Dockerfile +6 -2
@@ 7,7 7,11 @@ USER root
COPY --from=docker:dind /usr/local/bin/docker /bin/
RUN \
    apk add --no-cache -X http://dl-3.alpinelinux.org/alpine/edge/testing/ \
    bash \
    git \
    openssh
    openssh && \
    ssh-keygen -A

USER laminar
ADD entry.sh /entry.sh

ENTRYPOINT [ "/entry.sh" ]

A laminarCI/build.sh => laminarCI/build.sh +24 -0
@@ 0,0 1,24 @@
#!/bin/sh

laminar_version="$1"
build_number="$2"
is_latest="$3"

if test -z "$laminar_version" || test -z "$build_number"; then
    echo "usage:
    $0 <laminar_version> <build_number> [<is_latest>]
    is_latest is a flag, it can be 'y' or blank"
    exit 150
fi

tag_base="mapperr/laminar:$laminar_version-$build_number"
tag_laminar_version="mapperr/laminar:$laminar_version"
tag_latest="mapperr/laminar:latest"

docker build -t $tag_base .
docker tag $tag_base $tag_laminar_version
test "$is_latest" = "y" && docker tag $tag_base $tag_latest

docker push $tag_base
docker push $tag_laminar_version
test "$is_latest" = "y" && docker push $tag_latest

A laminarCI/entry.sh => laminarCI/entry.sh +18 -0
@@ 0,0 1,18 @@
#!/bin/sh -ex

if ! test -z "$LAMINAR_ENABLE_SSH"; then
    mkdir /var/lib/laminar/.ssh && \
    chown laminar:users /var/lib/laminar/.ssh && \
    chmod 700 /var/lib/laminar/.ssh && \
    sed -i -e 's#^laminar:x:100:100:Laminar:/var/lib/laminar:/sbin/nologin#laminar:x:100:100:Laminar:/var/lib/laminar:/bin/bash#' /etc/passwd && \
    sed -i -e 's/^laminar:!:/laminar:*:/' /etc/shadow && \
    chmod a+x /entry.sh
    for pubkey in $(ls /etc/authorized_keys); do
        cat /etc/authorized_keys/$pubkey \
            >> /var/lib/laminar/.ssh/authorized_keys
    done
    chown laminar:users /var/lib/laminar/.ssh/authorized_keys
    exec /usr/sbin/sshd -D -e "$@" &
fi

su -l laminar -s /bin/sh -c laminard