From cc21e6f59d906c753fc1f8a376993edc423ea7a1 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Tue, 17 Apr 2018 12:22:52 +0100 Subject: [PATCH] Initial commit --- .drone.yml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 29 +++++++++++++++++++++++++++++ README.md | 15 +++++++++++++++ skel/etc/profile | 22 ++++++++++++++++++++++ skel/usr/bin/ppwd | 19 +++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 skel/etc/profile create mode 100644 skel/usr/bin/ppwd diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..89268e2 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,35 @@ +pipeline: + build: + image: spritsail/docker-build + volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] + repo: alpine-dev + build_args: + - ALPINE_TAG=${ALPINE_TAG} + + test: + image: docker + volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] + commands: + - docker run --rm alpine-dev /bin/sh -xec 'apk --version' + + publish: + image: spritsail/docker-publish + when: { branch: [ master ], event: [ push, tag, deployment ] } + volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] + secrets: [ docker_username, docker_password, microbadger_token ] + from: alpine-dev + repo: 'spritsail/alpine:${ALPINE_TAG}' + + notify: + image: spritsail/notify + when: { status: [ success, failure ] } + secrets: [ webhook_url, notify_token ] + +matrix: + ALPINE_TAG: + - 3.4 + - 3.5 + - 3.6 + - 3.7 + - latest + - edge diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9efe92b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +ARG SU_EXEC_VER=v0.3 +ARG ALPINE_TAG=3.7 + +FROM alpine:$ALPINE_TAG + +ARG SU_EXEC_VER +ARG ALPINE_TAG + +LABEL maintainer="Spritsail " \ + org.label-schema.vendor="Spritsail" \ + org.label-schema.name="Alpine Linux" \ + org.label-schema.url="https://github.com/gliderlabs/docker-alpine" \ + org.label-schema.description="Alpine Linux base image" \ + org.label-schema.version=${ALPINE_TAG} \ + io.spritsail.version.su-exec=${SU_EXEC_VER} + +# Override shell for sh-y debugging goodness +SHELL ["/bin/sh", "-exc"] + +COPY skel/ / +ENV ENV="/etc/profile" +RUN apk --no-cache add \ + tini \ + openssl \ + && wget -qO /sbin/su-exec https://github.com/frebib/su-exec/releases/download/${SU_EXEC_VER}/su-exec-alpine-$(uname -m) \ + && chmod +x /sbin/su-exec /usr/bin/* \ + && apk --no-cache del openssl + +ENTRYPOINT ["/sbin/tini" , "--"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..39d73bf --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +[hub]: https://hub.docker.com/r/spritsail/alpine +[git]: https://github.com/spritsail/alpine +[drone]: https://drone.spritsail.io/spritsail/alpine +[mbdg]: https://microbadger.com/images/spritsail/alpine +[musl]: https://www.musl-libc.org/ +[uclibc]: https://www.uclibc.org/ + +# [spritsail/alpine][hub] - Alpine Linux base image +[![Layers](https://images.microbadger.com/badges/image/spritsail/alpine.svg)][mbdg] +[![Latest Version](https://images.microbadger.com/badges/version/spritsail/alpine.svg)][hub] +[![Git Commit](https://images.microbadger.com/badges/commit/spritsail/alpine.svg)][git] +[![Docker Stars](https://img.shields.io/docker/stars/spritsail/alpine.svg)][hub] +[![Docker Pulls](https://img.shields.io/docker/pulls/spritsail/alpine.svg)][hub] +[![Build Status](https://drone.spritsail.io/api/badges/spritsail/alpine/status.svg)][drone] + diff --git a/skel/etc/profile b/skel/etc/profile new file mode 100644 index 0000000..d1c9d65 --- /dev/null +++ b/skel/etc/profile @@ -0,0 +1,22 @@ +export PAGER='/bin/less -R' +export EDITOR='/bin/vi' +export PS1='\e[1;36m\u@\h\e[0m \e[0;32m$(ppwd)\e[0m> ' + +# Source configuration files from /etc/profile.d +for i in /etc/profile.d/*.sh ; do + if [ -r "$i" ]; then + . $i + fi + unset i +done + +# Common interactive aliases +alias ls='ls --color=auto -Fh' +alias ll='ls -l' +alias la='ls -la' + +alias cp='cp -i' +alias mv='mv -i' +alias rm='rm -i' +alias md='mkdir' +alias dd='rmdir' diff --git a/skel/usr/bin/ppwd b/skel/usr/bin/ppwd new file mode 100644 index 0000000..7b52105 --- /dev/null +++ b/skel/usr/bin/ppwd @@ -0,0 +1,19 @@ +#!/bin/sh +set -e -o pipefail + +dir="$(echo -n "${1:-$PWD}" | sed "s|$HOME|~|")" + +if [ "$dir" = '~' -o "$dir" = '/' ]; then + echo "$dir" + exit 0 +fi + +parts="$(echo "$dir" | tr '/' '\n' | sed '$d')" +last="$(echo "$dir" | tr '/' '\n' | tail -n 1)" + +for d in "$parts"; do + out="$out$(echo "$d" | sed -E '/^\./s/^(.{2}).*/\1/;/^[^\.]/s/^(.{1}).*/\1/')\n" +done + +echo -en "$out" | tr '\n' '/' +echo "$last" \ No newline at end of file