diff --git a/admin/Dockerfile b/admin/Dockerfile index 0ad7be7af..41b1bbab1 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -57,7 +57,9 @@ WORKDIR ${DOCKER_WORKDIR} FROM base as bun-base RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}" diff --git a/backend/Dockerfile b/backend/Dockerfile index 4ab2f1883..eeab1ac17 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -54,8 +54,9 @@ WORKDIR ${DOCKER_WORKDIR} FROM base as bun-base RUN apt update && apt install -y --no-install-recommends ca-certificates curl bash unzip -#RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}" diff --git a/database/Dockerfile b/database/Dockerfile index c8d1f40a2..48aa3326d 100644 --- a/database/Dockerfile +++ b/database/Dockerfile @@ -46,7 +46,9 @@ FROM base as bun-base #RUN apt update && apt install -y --no-install-recommends ca-certificates curl bash unzip RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}" diff --git a/deployment/bare_metal/install-missing-deps.sh b/deployment/bare_metal/install-missing-deps.sh index 52c1f7fab..a75a574dc 100644 --- a/deployment/bare_metal/install-missing-deps.sh +++ b/deployment/bare_metal/install-missing-deps.sh @@ -19,19 +19,34 @@ install_nvm() { } nvm use || install_nvm -# check for some tools and install them, when missing -# bun https://bun.sh/install, faster packet-manager as yarn -if ! command -v bun &> /dev/null +# unzip needed for bun install script +if ! command -v unzip &> /dev/null then - if ! command -v unzip &> /dev/null - then - echo "'unzip' is missing, will be installed now!" - sudo apt-get install -y unzip - fi - echo "'bun' is missing, will be installed now!" - curl -fsSL https://bun.sh/install | bash + echo "'unzip' is missing, will be installed now!" + sudo apt-get install -y unzip +fi + +# check for some tools and install them, when missing +# bun https://bun.com/install, faster packet-manager as yarn +BUN_VERSION_FILE="$PROJECT_ROOT/.bun-version" +if [ ! -f "$BUN_VERSION_FILE" ]; then + echo ".bun-version file not found at: $BUN_VERSION_FILE" + exit 1 +fi +BUN_VERSION="$(cat "$BUN_VERSION_FILE" | tr -d '[:space:]')" +if ! command -v bun &> /dev/null +then + echo "'bun' is missing, v$BUN_VERSION will be installed now!" + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" +else + CURRENT_VERSION="$(bun --version | tr -d '[:space:]')" + if [ "$CURRENT_VERSION" != "$BUN_VERSION" ] + then + echo "'bun' is outdated, v$BUN_VERSION will be installed now!" + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" + fi fi # turbo https://turborepo.com/docs/getting-started if ! command -v turbo &> /dev/null diff --git a/dht-node/Dockerfile b/dht-node/Dockerfile index c19888a5d..963e093d6 100644 --- a/dht-node/Dockerfile +++ b/dht-node/Dockerfile @@ -57,8 +57,9 @@ WORKDIR ${DOCKER_WORKDIR} FROM base as bun-base RUN apt update && apt install -y --no-install-recommends ca-certificates curl bash unzip -#RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}" diff --git a/federation/Dockerfile b/federation/Dockerfile index a8fcfd769..c3a45bf3d 100644 --- a/federation/Dockerfile +++ b/federation/Dockerfile @@ -55,8 +55,9 @@ WORKDIR ${DOCKER_WORKDIR} FROM base as bun-base RUN apt update && apt install -y --no-install-recommends ca-certificates curl bash unzip -#RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}" diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 23ca0685e..05e9e2255 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -57,7 +57,9 @@ WORKDIR ${DOCKER_WORKDIR} FROM base as bun-base RUN apk update && apk add --no-cache curl tar bash -RUN curl -fsSL https://bun.sh/install | bash +COPY .bun-version .bun-version +RUN BUN_VERSION=$(cat .bun-version) && \ + curl -fsSL https://bun.com/install | bash -s "bun-v${BUN_VERSION}" # Add bun's global bin directory to PATH ENV PATH="/root/.bun/bin:${PATH}"