From 44637143f6f26d86e53b2dd53d3a55700980916e Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Sat, 1 Jun 2024 10:10:11 -0600 Subject: [PATCH] Use pipe fail, quote array expansion and prevent word globbing --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index efab805..b545948 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,8 @@ ENV URL_MLAT_CLIENT_REPO="https://github.com/wiedehopf/mlat-client.git" \ PRIVATE_MLAT="false" \ MLAT_INPUT_TYPE="auto" -RUN set -x && \ - TEMP_PACKAGES=() && \ +SHELL ["/bin/bash", "-o", "pipefail", "-x"] +RUN TEMP_PACKAGES=() && \ KEPT_PACKAGES=() && \ # Git and net-tools are needed to install and run @Mikenye's HealthCheck framework KEPT_PACKAGES+=(git) && \ @@ -31,8 +31,8 @@ RUN set -x && \ # Install all these packages: apt-get update -q -y && \ apt-get install -o Dpkg::Options::="--force-confnew" -y --no-install-recommends -q \ - ${KEPT_PACKAGES[@]} \ - ${TEMP_PACKAGES[@]} && \ + "${KEPT_PACKAGES[@]}" \ + "${TEMP_PACKAGES[@]}" && \ # # Compile and Install the mlat_client mkdir -p /git && \ @@ -45,7 +45,7 @@ RUN set -x && \ rm -rf /git && \ # # Clean up and install POST_PACKAGES: - apt-get remove -q -y ${TEMP_PACKAGES[@]} && \ + apt-get remove -q -y "${TEMP_PACKAGES[@]}" && \ # apt-get install -o Dpkg::Options::="--force-confnew" -y --no-install-recommends -q \ # ${POST_PACKAGES[@]} && \ apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \ @@ -63,7 +63,7 @@ COPY rootfs/ / RUN set -x && \ branch="##BRANCH##" && \ [[ "${branch:0:1}" == "#" ]] && branch="main" || true && \ - git clone --depth=1 -b $branch https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git /tmp/clone && \ + git clone --depth=1 -b "$branch" https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git /tmp/clone && \ pushd /tmp/clone && \ echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > /.CONTAINER_VERSION && \ popd && \