Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/meteor 2.13 #35

Merged
merged 15 commits into from
Dec 22, 2023
Merged
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
app
bundle
node_modules
13 changes: 12 additions & 1 deletion .github/workflows/test-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Test-Publish
on: push
on:
push:
branches:
- master
pull_request:

jobs:
test:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions image/scripts/onbuild-node.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
29 changes: 28 additions & 1 deletion image/scripts/setup_nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading