From 18b12a0582d0162294e043eb2a7c85481f7b885c Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Wed, 12 Oct 2022 09:03:59 +1100 Subject: [PATCH 1/3] Remove ignore scripts (nuxt requires it) Add another facility to skip the pre-commit installation in environments that do not need it --- Dockerfile | 5 ++++- bin/install-pre-commit.sh | 11 +++++++++++ package.json | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 bin/install-pre-commit.sh diff --git a/Dockerfile b/Dockerfile index a9932b0d05..74f17ef003 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,12 @@ RUN pnpm fetch # copy the rest of the content COPY --chown=node:node . /home/node/app +# Prevent pre-commit from being installed, we don't need it here and it fails to install anyway +ENV SKIP_PRE_COMMIT=true + # `--ignore-scripts` prevents the `prepare` script from running. This avoids # installation of pre-commit inside the container. -RUN pnpm install -r --offline --ignore-scripts +RUN pnpm install -r --offline # disable telemetry when building the app ENV NUXT_TELEMETRY_DISABLED=1 diff --git a/bin/install-pre-commit.sh b/bin/install-pre-commit.sh new file mode 100755 index 0000000000..ab74b9cd62 --- /dev/null +++ b/bin/install-pre-commit.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +set -e + +if [[ -z "$SKIP_PRE_COMMIT" ]] +then + echo "installing pre-commit" + pnpm pc:download && pnpm pc:install +else + echo "skipping pre-commit installation" +fi diff --git a/package.json b/package.json index e73b7aa335..40f9ed0085 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "author": "sebworks", "private": true, "scripts": { - "prepare": "pnpm pc:download && pnpm pc:install", + "prepare": "./bin/install-pre-commit.sh", "predev": "pnpm install && pnpm i18n:no-get", "dev": "pnpm dev:only", "dev:only": "nuxt --hostname 0.0.0.0", From fad261e73287f348a70e9cc81286b01d5cb29a03 Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Wed, 12 Oct 2022 09:27:33 +1100 Subject: [PATCH 2/3] Use `sh` instead of `bash` `bash` appears to be unavailable in CI docker for some reason, despite working fine locally... go figure? --- bin/install-pre-commit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install-pre-commit.sh b/bin/install-pre-commit.sh index ab74b9cd62..5f81820f9d 100755 --- a/bin/install-pre-commit.sh +++ b/bin/install-pre-commit.sh @@ -1,8 +1,8 @@ -#! /usr/bin/env bash +#! /usr/bin/env sh set -e -if [[ -z "$SKIP_PRE_COMMIT" ]] +if [ -z "$SKIP_PRE_COMMIT" ] then echo "installing pre-commit" pnpm pc:download && pnpm pc:install From 5a7334ff1a219de104dd0f7d594990c5ec96d8cd Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Wed, 12 Oct 2022 09:47:21 +1100 Subject: [PATCH 3/3] Remove stale comment Co-authored-by: Krystle Salazar --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74f17ef003..d8b07cf334 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,6 @@ COPY --chown=node:node . /home/node/app # Prevent pre-commit from being installed, we don't need it here and it fails to install anyway ENV SKIP_PRE_COMMIT=true -# `--ignore-scripts` prevents the `prepare` script from running. This avoids -# installation of pre-commit inside the container. RUN pnpm install -r --offline # disable telemetry when building the app