diff --git a/.eslintignore b/.eslintignore index 26bc999..36ee21c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ app bundle +node_modules diff --git a/.github/workflows/test-publish.yaml b/.github/workflows/test-publish.yaml index aa07891..f173b2d 100644 --- a/.github/workflows/test-publish.yaml +++ b/.github/workflows/test-publish.yaml @@ -1,5 +1,9 @@ name: Test-Publish -on: push +on: + push: + branches: + - master + pull_request: jobs: test: @@ -24,6 +28,13 @@ jobs: - '--release=2.4.1' - '--release=2.5.6' - '--release=2.6' + - '--release=2.7' + - '--release=2.8.0' + - '--release=2.9.0' + - '--release=2.10.0' + - '--release=2.11.0' + - '--release=2.12' + - '--release=2.13.3' # Latest version - steps: diff --git a/image/Dockerfile b/image/Dockerfile index 779e8a5..bc4217b 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,7 +1,7 @@ FROM debian:bullseye-slim LABEL maintainer="zodern" RUN apt-get update && \ - apt-get install -y curl python make g++ bzip2 ca-certificates --no-install-recommends && \ + apt-get install -y curl python python3 make g++ bzip2 ca-certificates --no-install-recommends && \ rm -rf /var/lib/apt/lists/* RUN useradd --create-home --shell /bin/bash --uid 1000 --user-group app diff --git a/image/scripts/onbuild-node.sh b/image/scripts/onbuild-node.sh index a27b2b2..c2bb699 100644 --- a/image/scripts/onbuild-node.sh +++ b/image/scripts/onbuild-node.sh @@ -1,7 +1,5 @@ . ./scripts/setup_nvm.sh -NODE_PATH=$(dirname $(nvm which $(node --version))) - rm -rf /home/app/.onbuild-node mkdir -p /home/app/.onbuild-node diff --git a/image/scripts/setup_nvm.sh b/image/scripts/setup_nvm.sh index 3e74f82..ab12d1c 100644 --- a/image/scripts/setup_nvm.sh +++ b/image/scripts/setup_nvm.sh @@ -4,11 +4,38 @@ export NVM_DIR="/home/app/.nvm" . "$NVM_DIR/nvm.sh" NODE_VERSION="$(node /home/app/scripts/node-version.js)" +# Replace a possible 'v' prefix +NODE_VERSION="$(echo $NODE_VERSION | sed 's/^v//')" echo "NODE_VERSION=$NODE_VERSION" if [[ $DEBUG_NODE_VERSION == "0" ]]; then cat /home/app/scripts/log.txt || true fi -nvm install $NODE_VERSION +MAJOR_NODE_VERSION=`echo $NODE_VERSION | awk -F. '{print $1}'` +MINOR_NODE_VERSION=`echo $NODE_VERSION | awk -F. '{print $2}'` +PATCH_NODE_VERSION=`echo $NODE_VERSION | awk -F. '{print $3}'` + +echo "Node: $NODE_VERSION (parsed: $MAJOR_NODE_VERSION.$MINOR_NODE_VERSION.$PATCH_NODE_VERSION)" + +if [[ $MAJOR_NODE_VERSION == "14" && $MINOR_NODE_VERSION -ge 21 && $PATCH_NODE_VERSION -ge 4 ]]; then + NODE_INSTALL_PATH="/home/app/.nvm/versions/node/v$NODE_VERSION" + + if [ -f $NODE_INSTALL_PATH ]; then + echo "Meteor's custom v14 LTS Node version is already installed ($NODE_VERSION)" + else + echo "Using Meteor's custom NodeJS v14 LTS version" + + # https://hub.docker.com/layers/meteor/node/14.21.4/images/sha256-f4e19b4169ff617118f78866c2ffe392a7ef44d4e30f2f9fc31eef2c35ceebf3?context=explore + curl "https://static.meteor.com/dev-bundle-node-os/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" | tar xzf - -C /tmp/ + mv /tmp/node-v$NODE_VERSION-linux-x64 $NODE_INSTALL_PATH + fi + + nvm use $NODE_VERSION +else + echo "Using NVM" + nvm install $NODE_VERSION +fi + nvm alias default $NODE_VERSION +export NODE_PATH=$(dirname $(nvm which $(node --version))) diff --git a/readme.md b/readme.md index bc5a77d..5bc6546 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,14 @@ zodern/meteor Docker Image === -![GitHub Workflow Status](https://img.shields.io/github/workflow/status/zodern/meteor-docker/Test-Publish) ![Docker Pulls](https://img.shields.io/docker/pulls/zodern/meteor) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/zodern/meteor-docker/test-publish.yaml?branch-master&style=flat-square) ![Docker Pulls](https://img.shields.io/docker/pulls/zodern/meteor?style=flat-square) Docker image to run Meteor apps. ### Features -- One image supports every Meteor version +- One image supports every Meteor version (tested with 1.2 - 2.13 and newer) +- Mostly supports Meteor 3 (requires making `programs/server/shrinkwrap.json` [writable](https://github.com/meteor/meteor/issues/12932) due to a bug in Meteor 3) - Automatically uses correct node and npm version - Runs app as non-root user - Compatible with Meteor up diff --git a/tests/test.sh b/tests/test.sh index d541e52..5cfda45 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -188,6 +188,13 @@ test_versions() { test_version "--release=2.4.1" test_version "--release=2.5.6" test_version "--release=2.6" + test_version "--release=2.7" + test_version "--release=2.8.0" + test_version "--release=2.9.0" + test_version "--release=2.10.0" + test_version "--release=2.11.0" + test_version "--release=2.12" + test_version "--release=2.13.3" # Latest version test_version