diff --git a/Dockerfile b/Dockerfile index a5188af..e18600b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,17 +8,11 @@ COPY /base / RUN apk add --no-cache \ bash=~5 \ ca-certificates=~20240226 \ - gnutls-utils=~3 \ - tini=~0 + gnutls-utils=~3 ARG workdir=/var/www WORKDIR "${workdir}" -SHELL ["/bin/ash", "-eo", "pipefail", "-c"] - -ENTRYPOINT [ "/sbin/tini", "--", "/usr/local/bin/entrypoint" ] -CMD [ "nginx", "-g", "daemon off;" ] - ## # Drupal ## diff --git a/context/base/docker-entrypoint.d/10-first-virtual-host.envsh b/context/base/docker-entrypoint.d/10-first-virtual-host.envsh new file mode 100755 index 0000000..17c197c --- /dev/null +++ b/context/base/docker-entrypoint.d/10-first-virtual-host.envsh @@ -0,0 +1,4 @@ +# shellcheck shell=sh + +FIRST_VIRTUAL_HOST=$(echo "${VIRTUAL_HOST:-localhost}" | awk '{print $1;}') +export FIRST_VIRTUAL_HOST diff --git a/context/base/etc/entrypoint.d/10-certs.sh b/context/base/docker-entrypoint.d/20-certs.sh similarity index 68% rename from context/base/etc/entrypoint.d/10-certs.sh rename to context/base/docker-entrypoint.d/20-certs.sh index 13f2801..fcb1058 100755 --- a/context/base/etc/entrypoint.d/10-certs.sh +++ b/context/base/docker-entrypoint.d/20-certs.sh @@ -1,25 +1,12 @@ -#!/usr/bin/env bash +# shellcheck shell=sh -set -euo pipefail - -FIRST_VIRTUAL_HOST=$(awk '{print $1;}' <<<"${VIRTUAL_HOST:-localhost}") -export FIRST_VIRTUAL_HOST - -echo "export FIRST_VIRTUAL_HOST=${FIRST_VIRTUAL_HOST}" >>/docker-entrypoint.d/10-first_virtual_host.envsh -chmod +x /docker-entrypoint.d/10-first_virtual_host.envsh - -mkdir -p /cert +mkdir -p /cert /etc/nginx/include.d CERT="/cert/${FIRST_VIRTUAL_HOST:-localhost}.crt" CERT_KEY="/cert/${FIRST_VIRTUAL_HOST:-localhost}.key" CA_CERT="/rootCA/rootCA.pem" CA_KEY="/rootCA/rootCA-key.pem" -# if [ ! -r "${CA_CERT}" ] || [ ! -r "${CA_KEY}" ]; then -# echo "No root certificate, skipping certificate generation" -# exit 0 -# fi - IP_ADDRESS=$(hostname -i) export IP_ADDRESS @@ -43,5 +30,4 @@ if [ -r "${CA_CERT}" ]; then /usr/sbin/update-ca-certificates fi -mkdir -p /etc/nginx/include.d envsubst /etc/nginx/include.d/ssl.conf diff --git a/context/base/usr/local/bin/entrypoint b/context/base/usr/local/bin/entrypoint deleted file mode 100755 index 8dc945e..0000000 --- a/context/base/usr/local/bin/entrypoint +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -/bin/run-parts --exit-on-error /etc/entrypoint.d - -exec /docker-entrypoint.sh "$@"