Skip to content

sdavids/sdavids-docker-healthcheck

Repository files navigation

sdavids-docker-healthcheck

Program Size Notes

shell - nc

4.0K

only checks the daemon’s port

JavaScript - Node.js

4.0K

the node binary would add 34.1M

Rust - http

188.0K

Rust - https

532.0K

Go - http

5.0M

Go - https

5.0M

curl alpine:3.17.9

6.2M

wget alpine:3.17.9

7.9M

wget alpine:3.20.2

8.6M

wget alpaquita-linux-base:stream-musl

8.8M

curl alpine:3.20.2

9.6M

wget debian:12.6-slim

9.7M

curl alpaquita-linux-base:stream-musl

10.3M

curl debian:12.6-slim

19.0M

$ cd go/http
$ scripts/docker_build.sh -t go-http
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:go-http sh -c 'du -kh /usr/local/bin/healthcheck'
5.0M    /usr/local/bin/healthcheck
$ cd go/https
$ scripts/docker_build.sh -t go-https
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:go-https sh -c 'du -kh /usr/local/bin/healthcheck'
5.0M    /usr/local/bin/healthcheck
ℹ️

This healthcheck is only useful in a Node.js Docker image, i.e. an image where the node binary already exists—​the node binary would add 34.1M.

$ cd js/nodejs
$ scripts/docker_build.sh -t js-nodejs
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:js-nodejs sh -c 'du -kh /node/healthcheck.mjs'
4.0K    /node/healthcheck.mjs
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:js-nodejs sh -c 'du -kh /usr/bin/node'
34.1M   /usr/bin/node
$ cd rust/http
$ scripts/docker_build.sh -t rust-http
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:rust-http sh -c 'du -kh /usr/local/bin/healthcheck'
188.0K  /usr/local/bin/healthcheck
$ cd rust/https
$ scripts/docker_build.sh -t rust-https
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:rust-https sh -c 'du -kh /usr/local/bin/healthcheck'
532.0K  /usr/local/bin/healthcheck
$ cd shell/nc
$ scripts/docker_build.sh -t shell-nc
$ docker run --rm de.sdavids/sdavids-docker-healthcheck:shell-nc sh -c 'du -kh /usr/local/bin/healthcheck'
4.0K    /usr/local/bin/healthcheck
$ docker run --rm alpine:3.17.9 sh -c "apk --no-cache --quiet --no-progress add curl=8.9.0-r0 && ldd /usr/bin/curl | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/curl"
268.0K  /usr/bin/curl
644.0K  /usr/lib/libcurl.so.4
100.0K  /lib/libz.so.1
604.0K  /lib/ld-musl-x86_64.so.1
164.0K  /usr/lib/libnghttp2.so.14
592.0K  /lib/libssl.so.3
3.7M    /lib/libcrypto.so.3
52.0K   /usr/lib/libbrotlidec.so.1
136.0K  /usr/lib/libbrotlicommon.so.1
6.2M    total
$ docker run --rm alpine:3.20.2 sh -c "apk --no-cache --quiet --no-progress add curl=8.9.0-r0 && ldd /usr/bin/curl | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/curl"
236.0K  /usr/bin/curl
612.0K  /usr/lib/libcurl.so.4
100.0K  /lib/libz.so.1
636.0K  /lib/ld-musl-x86_64.so.1
144.0K  /usr/lib/libcares.so.2
140.0K  /usr/lib/libnghttp2.so.14
196.0K  /usr/lib/libidn2.so.0
76.0K   /usr/lib/libpsl.so.5
780.0K  /lib/libssl.so.3
4.3M    /lib/libcrypto.so.3
704.0K  /usr/lib/libzstd.so.1
56.0K   /usr/lib/libbrotlidec.so.1
1.6M    /usr/lib/libunistring.so.5
140.0K  /usr/lib/libbrotlicommon.so.1
9.6M    total
$ docker run --rm bellsoft/alpaquita-linux-base:stream-musl-240821 sh -c "apk --no-cache --quiet --no-progress add curl=8.9.1-r0 && ldd /usr/bin/curl | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/curl"
236.0K  /usr/bin/curl
612.0K  /lib/libcurl.so.4
100.0K  /lib/libz.so.1
788.0K  /lib/ld-musl-x86_64.so.1
160.0K  /lib/libcares.so.2
140.0K  /lib/libnghttp2.so.14
196.0K  /lib/libidn2.so.0
76.0K   /lib/libpsl.so.5
780.0K  /lib/libssl.so.3
4.3M    /lib/libcrypto.so.3
1.1M    /lib/libzstd.so.1
56.0K   /lib/libbrotlidec.so.1
1.6M    /lib/libunistring.so.5
140.0K  /lib/libbrotlicommon.so.1
10.3M   total
$ docker run --rm debian:12.6-slim sh -c "apt-get -qq update && apt-get -qq install -y curl=7.88.1-10+deb12u6 >/dev/null 2>&1 && ldd /usr/bin/curl | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/curl"
276K    /usr/bin/curl
696K    /lib/x86_64-linux-gnu/libcurl.so.4
120K    /lib/x86_64-linux-gnu/libz.so.1
1.9M    /lib/x86_64-linux-gnu/libc.so.6
188K    /lib/x86_64-linux-gnu/libnghttp2.so.14
196K    /lib/x86_64-linux-gnu/libidn2.so.0
120K    /lib/x86_64-linux-gnu/librtmp.so.1
256K    /lib/x86_64-linux-gnu/libssh2.so.1
76K     /lib/x86_64-linux-gnu/libpsl.so.5
676K    /lib/x86_64-linux-gnu/libssl.so.3
4.5M    /lib/x86_64-linux-gnu/libcrypto.so.3
332K    /lib/x86_64-linux-gnu/libgssapi_krb5.so.2
372K    /lib/x86_64-linux-gnu/libldap-2.5.so.0
64K     /lib/x86_64-linux-gnu/liblber-2.5.so.0
748K    /lib/x86_64-linux-gnu/libzstd.so.1
48K     /lib/x86_64-linux-gnu/libbrotlidec.so.1
1.8M    /lib/x86_64-linux-gnu/libunistring.so.2
2.1M    /lib/x86_64-linux-gnu/libgnutls.so.30
288K    /lib/x86_64-linux-gnu/libhogweed.so.6
312K    /lib/x86_64-linux-gnu/libnettle.so.8
520K    /lib/x86_64-linux-gnu/libgmp.so.10
868K    /lib/x86_64-linux-gnu/libkrb5.so.3
180K    /lib/x86_64-linux-gnu/libk5crypto.so.3
20K     /lib/x86_64-linux-gnu/libcom_err.so.2
52K     /lib/x86_64-linux-gnu/libkrb5support.so.0
112K    /lib/x86_64-linux-gnu/libsasl2.so.2
136K    /lib/x86_64-linux-gnu/libbrotlicommon.so.1
1.3M    /lib/x86_64-linux-gnu/libp11-kit.so.0
84K     /lib/x86_64-linux-gnu/libtasn1.so.6
24K     /lib/x86_64-linux-gnu/libkeyutils.so.1
60K     /lib/x86_64-linux-gnu/libresolv.so.2
44K     /lib/x86_64-linux-gnu/libffi.so.8
19M     total
$ docker run --rm alpine:3.17.9 sh -c "apk --no-cache --quiet --no-progress add wget=1.21.4-r0 && ldd /usr/bin/wget | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/wget"
464.0K  /usr/bin/wget
644.0K  /usr/lib/libpcre2-8.so.0
196.0K  /usr/lib/libidn2.so.0
592.0K  /lib/libssl.so.3
3.7M    /lib/libcrypto.so.3
100.0K  /lib/libz.so.1
604.0K  /lib/ld-musl-x86_64.so.1
1.7M    /usr/lib/libunistring.so.5
7.9M    total
$ docker run --rm alpine:3.20.2 sh -c "apk --no-cache --quiet --no-progress add wget=1.24.5-r0 && ldd /usr/bin/wget | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/wget"
404.0K  /usr/bin/wget
680.0K  /usr/lib/libpcre2-8.so.0
196.0K  /usr/lib/libidn2.so.0
780.0K  /lib/libssl.so.3
4.3M    /lib/libcrypto.so.3
100.0K  /lib/libz.so.1
636.0K  /lib/ld-musl-x86_64.so.1
1.6M    /usr/lib/libunistring.so.5
8.6M    total
$ docker run --rm bellsoft/alpaquita-linux-base:stream-musl-240821 sh -c "apk --no-cache --quiet --no-progress add wget=1.24.5-r0 && ldd /usr/bin/wget | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/wget"
404.0K  /usr/bin/wget
684.0K  /lib/libpcre2-8.so.0
196.0K  /lib/libidn2.so.0
780.0K  /lib/libssl.so.3
4.3M    /lib/libcrypto.so.3
100.0K  /lib/libz.so.1
788.0K  /lib/ld-musl-x86_64.so.1
1.6M    /lib/libunistring.so.5
8.8M    total
$ docker run --rm debian:12.6-slim sh -c "apt-get -qq update && apt-get -qq install -y wget=1.21.3-1+b2 >/dev/null 2>&1 && ldd /usr/bin/wget | awk '{ print $ 3}' | xargs du -ckshL /usr/bin/wget"
528K    /usr/bin/wget
616K    /lib/x86_64-linux-gnu/libpcre2-8.so.0
36K     /lib/x86_64-linux-gnu/libuuid.so.1
196K    /lib/x86_64-linux-gnu/libidn2.so.0
312K    /lib/x86_64-linux-gnu/libnettle.so.8
2.1M    /lib/x86_64-linux-gnu/libgnutls.so.30
120K    /lib/x86_64-linux-gnu/libz.so.1
76K     /lib/x86_64-linux-gnu/libpsl.so.5
1.9M    /lib/x86_64-linux-gnu/libc.so.6
1.8M    /lib/x86_64-linux-gnu/libunistring.so.2
1.3M    /lib/x86_64-linux-gnu/libp11-kit.so.0
84K     /lib/x86_64-linux-gnu/libtasn1.so.6
288K    /lib/x86_64-linux-gnu/libhogweed.so.6
520K    /lib/x86_64-linux-gnu/libgmp.so.10
44K     /lib/x86_64-linux-gnu/libffi.so.8
9.7M    total

We abide by the Contributor Covenant, Version 2.1 and ask that you do as well.

For more information, please see Code of Conduct.

$ scripts/format.sh
$ scripts/lint.sh

After initializing this repository you need to install the Git hooks via:

$ git config core.hooksPath .githooks

And configure the ignore-revs-file:

git config blame.ignoreRevsFile .git-blame-ignore-revs

Ensure that you install version 3.1.7 and not 3.2.0!

Version 3.2.0 is an incompatible development snapshot release.

Install easyrsa.

⚠️

Unfortunately, homebrew provides easy-rsa version 3.2.0 at this point in time (August 2024).

$ curl -L https://github.com/OpenVPN/easy-rsa/releases/download/v3.1.7/EasyRSA-3.1.7.tgz -o ~/Downloads/easy-rsa.tgz
$ tar -xzf ~/Downloads/easy-rsa.tgz -C ~/.local/share
$ mv  ~/.local/share/EasyRSA-3.1.7 ~/.local/share/easyrsa
$ ln -s ~/.local/share/easyrsa/easyrsa ~/.local/bin/easyrsa
$ rm ~/Downloads/easy-rsa.tgz

Install Go.

Install hadolint.

$ brew install hadolint

Install fnm or NVM.

~/.zprofile
if command -v fnm > /dev/null 2>&1; then
  eval "$(fnm env --use-on-cd)"
fi
~/.zshrc
export NVM_DIR="${HOME}/.nvm"

[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh"
[ -s "${NVM_DIR}/bash_completion" ] && . "${NVM_DIR}/bash_completion"

if command -v nvm > /dev/null 2>&1; then
  autoload -U add-zsh-hook
  load-nvmrc() {
    local nvmrc_path="$(nvm_find_nvmrc)"
    if [ -n "${nvmrc_path}" ]; then
      local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
      if [ "${nvmrc_node_version}" = "N/A" ]; then
        nvm install
      elif [ "${nvmrc_node_version}" != "$(nvm version)" ]; then
        nvm use
      fi
    elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
      echo "Reverting to nvm default version"
      nvm use default
    fi
  }

  add-zsh-hook chpwd load-nvmrc
  load-nvmrc
fi

Install Rust.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --component rust-analyzer
$ sudo apt-get install shellcheck
$ brew install shellcheck
$ sudo apt-get install shfmt
$ brew install shfmt
$ sudo apt-get install yamllint
$ brew install yamllint