From 37cfc089392cb5eb757981da3c2de34b5503dbcd Mon Sep 17 00:00:00 2001 From: Ron Green <11993626+georgettica@users.noreply.github.com> Date: Wed, 30 Dec 2020 10:11:03 +0200 Subject: [PATCH 1/2] init(dockerfile): add additional file currently fails on https://github.com/pypa/virtualenv/issues/1907 if I understand correctly to test run 'docker built -t test -f pre-commit.Dockerfile .' and see the error --- pre-commit.Dockerfile | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 pre-commit.Dockerfile diff --git a/pre-commit.Dockerfile b/pre-commit.Dockerfile new file mode 100644 index 0000000..06d25d2 --- /dev/null +++ b/pre-commit.Dockerfile @@ -0,0 +1,61 @@ +# Developer: +# --------- +# Name: Maik Ellerbrock +# +# GitHub: https://github.com/ellerbrock +# Twitter: https://twitter.com/frapsoft +# Docker: https://hub.docker.com/u/ellerbrock +# Quay: https://quay.io/user/ellerbrock +# +# Description: +# ----------- +# Bash Shell v.5 bats and deps for development + +FROM bash:5 + +MAINTAINER Maik Ellerbrock + +ENV VERSION 0.1.0 + +# Optional Configuration Parameter +ARG SYSTEM_TZ + +# Default Settings (for optional Parameter) +ENV SYSTEM_TZ ${SYSTEM_TZ:-Europe/Berlin} + +ENV SERVICE_USER bashit +ENV SERVICE_HOME /home/${SERVICE_USER} + +# Configure Go +ENV GOROOT /usr/lib/go +ENV GOPATH ${SERVICE_HOME}/go + +RUN \ + adduser -h ${SERVICE_HOME} -s /bin/bash -u 1000 -D ${SERVICE_USER} && \ + apk add --no-cache \ + dumb-init \ + git \ + go \ + py3-pip \ + python3 \ + python3-dev \ + shellcheck \ + tzdata && \ + cp /usr/share/zoneinfo/${SYSTEM_TZ} /etc/localtime && \ + echo "${SYSTEM_TZ}" > /etc/TZ && \ + pip3 install pre-commit && \ + GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt && \ + ln -s ${GOPATH}/bin/shfmt /usr/local/bin \ + git clone --depth 1 https://github.com/sstephenson/bats.git /tmp/bats && \ + /tmp/bats/install.sh /usr/local && \ + chown -R ${SERVICE_USER}:${SERVICE_USER} ${SERVICE_HOME} && \ + sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd && \ + apk del git tzdata && \ + rm -rf /tmp/{.}* /tmp/* + +USER ${SERVICE_USER} + +WORKDIR ${SERVICE_HOME} + +ENTRYPOINT [ "/usr/bin/dumb-init", "bash" ] + From d9ab4dd576b420d0d018fb673f221926d6e83dc1 Mon Sep 17 00:00:00 2001 From: Ron Green <11993626+georgettica@users.noreply.github.com> Date: Sun, 7 Mar 2021 12:55:16 +0200 Subject: [PATCH 2/2] fix(dockerfile): change to be cleaner Co-authored-by: Noah Gorny --- pre-commit.Dockerfile | 55 +++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/pre-commit.Dockerfile b/pre-commit.Dockerfile index 06d25d2..b756751 100644 --- a/pre-commit.Dockerfile +++ b/pre-commit.Dockerfile @@ -1,21 +1,16 @@ # Developer: # --------- -# Name: Maik Ellerbrock -# -# GitHub: https://github.com/ellerbrock -# Twitter: https://twitter.com/frapsoft -# Docker: https://hub.docker.com/u/ellerbrock -# Quay: https://quay.io/user/ellerbrock +# Name: Ron Green # # Description: # ----------- # Bash Shell v.5 bats and deps for development -FROM bash:5 +FROM fedora -MAINTAINER Maik Ellerbrock +MAINTAINER Noah Gorny -ENV VERSION 0.1.0 +ENV VERSION 0.2.0 # Optional Configuration Parameter ARG SYSTEM_TZ @@ -26,35 +21,27 @@ ENV SYSTEM_TZ ${SYSTEM_TZ:-Europe/Berlin} ENV SERVICE_USER bashit ENV SERVICE_HOME /home/${SERVICE_USER} +RUN dnf install --assumeyes \ + ShellCheck \ + golang \ + pip \ + python \ + python-devel \ + dumb-init \ + && \ + dnf clean all +RUN pip3 install pre-commit + # Configure Go -ENV GOROOT /usr/lib/go -ENV GOPATH ${SERVICE_HOME}/go - -RUN \ - adduser -h ${SERVICE_HOME} -s /bin/bash -u 1000 -D ${SERVICE_USER} && \ - apk add --no-cache \ - dumb-init \ - git \ - go \ - py3-pip \ - python3 \ - python3-dev \ - shellcheck \ - tzdata && \ +RUN GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt && \ + ln -s ~/bin/shfmt /usr/local/bin + +# create a local user so we don't use ROOT +RUN adduser --home-dir=${SERVICE_HOME} --shell=/bin/bash -u 1000 ${SERVICE_USER} && \ cp /usr/share/zoneinfo/${SYSTEM_TZ} /etc/localtime && \ - echo "${SYSTEM_TZ}" > /etc/TZ && \ - pip3 install pre-commit && \ - GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt && \ - ln -s ${GOPATH}/bin/shfmt /usr/local/bin \ - git clone --depth 1 https://github.com/sstephenson/bats.git /tmp/bats && \ - /tmp/bats/install.sh /usr/local && \ chown -R ${SERVICE_USER}:${SERVICE_USER} ${SERVICE_HOME} && \ - sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd && \ - apk del git tzdata && \ - rm -rf /tmp/{.}* /tmp/* - + sed -i -e "s/bin\/ash/bin\/bash/" /etc/passwd USER ${SERVICE_USER} - WORKDIR ${SERVICE_HOME} ENTRYPOINT [ "/usr/bin/dumb-init", "bash" ]