~mapperr/dockerfiles

81a82702d02bc892b4bfcad979064738106bb9d8 — mapperr 6 months ago 6b653c1
add webhookd
2 files changed, 35 insertions(+), 17 deletions(-)

M laminarCI/Dockerfile
M laminarCI/entry.sh
M laminarCI/Dockerfile => laminarCI/Dockerfile +17 -8
@@ 6,6 6,23 @@ FROM laminarci/laminar

USER root

ADD https://raw.githubusercontent.com/ncarlier/webhookd/master/install.sh /webhookd_install.sh
RUN <<-EOF
    set -e
	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
    apk add --no-cache -X http://dl-3.alpinelinux.org/alpine/edge/testing/ \
    bash \
    curl \
    git \
    rsync \
    jq \
    openssh \
    gcompat
    # ^-- gcompat is for webhookd
    bash /webhookd_install.sh /bin
EOF

COPY <<-EOF /bin/laminar_ssh_entrypoint
    laminarc \$SSH_ORIGINAL_COMMAND
EOF


@@ 14,20 31,12 @@ COPY --from=docker:dind /usr/local/bin/docker /bin/
RUN <<-EOF
    set -e
    chmod u+x /bin/laminar_ssh_entrypoint
    apk add --no-cache -X http://dl-3.alpinelinux.org/alpine/edge/testing/ \
    bash \
    git \
    rsync \
    curl \
    jq \
    openssh
    ssh-keygen -A
    mkdir /var/lib/laminar/.ssh
    chown laminar:users /var/lib/laminar/.ssh
    chmod 700 /var/lib/laminar/.ssh
EOF


ADD entry.sh /entry.sh
RUN <<-EOF
    chmod a+x /entry.sh

M laminarCI/entry.sh => laminarCI/entry.sh +18 -9
@@ 1,15 1,24 @@
#!/bin/sh -ex

if ! test -z "$LAMINAR_ENABLE_SSH"; then
    rm -rf /var/lib/laminar/.ssh/authorized_keys
    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
    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 "$@" &
	rm -rf /var/lib/laminar/.ssh/authorized_keys
	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

if ! test -z "$LAMINAR_ENABLE_WEBHOOKS"; then
    laminar_config=$LAMINAR_HOME/cfg
    test -z "$LAMINAR_HOME" &&
        laminar_config=/var/lib/laminar/cfg
    test -z "$WHD_SCRIPTS" &&
        WHD_SCRIPTS=$laminar_config/webhooks
    export WHD_SCRIPTS
    export WHD_LISTEN_ADDR=":9090"
    su laminar -c webhookd &
fi

su laminar -c laminard