Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- '--release=3.3.2'
- '--release=3.4.1'
# Latest version
-
- 'latest'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
32 changes: 30 additions & 2 deletions image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
FROM debian:bullseye-slim
# trixie doesn't have python 2, so we copy it from bullseye
FROM debian:bullseye-slim AS python2
RUN apt-get update && \
apt-get install -y python2.7 libpython2.7 libssl1.1 --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

FROM debian:trixie-slim
LABEL maintainer="zodern"

# libnsl2 needed for python 2
RUN apt-get update && \
apt-get install -y curl python python3 make g++ bzip2 ca-certificates --no-install-recommends && \
apt-get install -y curl python3 make g++ bzip2 ca-certificates libnsl2 --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

# Copy python 2 and make sure nothing is missing
COPY --from=python2 /usr/bin/python2.7 /usr/bin/python2.7
COPY --from=python2 /usr/lib/python2.7 /usr/lib/python2.7
COPY --from=python2 /usr/lib/*-linux-gnu/libpython2.7.so.1.0 /usr/local/lib/
COPY --from=python2 /usr/lib/*-linux-gnu/libssl.so.1.1 /usr/local/lib/
COPY --from=python2 /usr/lib/*-linux-gnu/libcrypto.so.1.1 /usr/local/lib/
COPY --from=python2 /usr/lib/*-linux-gnu/libffi.so.7.* /usr/local/lib/
RUN ldconfig && \
set -e && \
for module in /usr/lib/python2.7/lib-dynload/*.so; do \
if ldd "$module" | grep -q 'not found'; then \
echo "Missing dependency for $module"; \
ldd "$module"; \
exit 1; \
fi; \
done && \
python2.7 -c 'import ssl, hashlib, ctypes, bz2, readline, sqlite3, zlib, nis' && \
ln -s /usr/bin/python2.7 /usr/bin/python2 && \
ln -s /usr/bin/python2.7 /usr/bin/python

RUN useradd --create-home --shell /bin/bash --uid 1000 --user-group app

RUN mkdir /built_app && \
Expand Down
11 changes: 7 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
zodern/meteor Docker Image
===

![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)
![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)](https://hub.docker.com/r/zodern/meteor)

Docker image to run Meteor apps.

### Features

- 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)
- One image supports every Meteor version (tested with 1.2 - 3.5)
- Automatically uses correct node and npm version
- Runs app as non-root user
- Compatible with Meteor up
Expand All @@ -17,9 +16,13 @@ Docker image to run Meteor apps.

- `zodern/meteor` The recommended version. Runs the app as a non-root user.
- `zodern/meteor:root` Compatible with meteord. Runs the app as the root user and has phantomjs installed. Any notes below about permissions do not apply to this image.
- `zodern/meteor:<major>` or `zodern/meteor:<major>-root` (for example, `zodern/meteor:1`) Use the latest minor or patch version, without any breaking changes in a new major version (such as changing to a newer Debian base image).
- `zodern/meteor:<major>` or `zodern/meteor:<major>-root` (for example, `zodern/meteor:1`) Use the latest minor or patch version, without any breaking changes from a new major version (such as changing to a newer Debian base image).
- `zodern/meteor:slim` Coming soon. Is a smaller image without node or npm pre-installed. During ONBUILD or when starting the app, it will install the correct version.

### Breaking changes in v1

Version 1 changed the base image from Debian 11 (bullseye) to Debian 13 (trixie). This is needed to support the uws DDP transport in Meteor 3.5. Old Meteor versions are still compatible. If the new base image causes problems for your app, you can use `zodern/meteor:0` or `zodern/meteor:0-root`.

## How To Use

### Permissions
Expand Down
3 changes: 2 additions & 1 deletion root-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN export VERSION="2.1.1" && \
mkdir phantomjs && \
tar xvjf phantomjs.tar.bz2 -C ./phantomjs --strip-components=1 && \
mv phantomjs /usr/local/share && \
ln -sf /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin && \
printf '#!/bin/sh\n# phantomjs statically links an old OpenSSL that can not read the\n# openssl.cnf in newer Debian versions\nOPENSSL_CONF=/dev/null exec /usr/local/share/phantomjs/bin/phantomjs "$@"\n' > /usr/local/bin/phantomjs && \
chmod +x /usr/local/bin/phantomjs && \
rm -rf ./phantomjs ./phantomjs.tar.bz2
ONBUILD USER root
ONBUILD ARG NODE_VERSION='8.17.0'
Expand Down
26 changes: 25 additions & 1 deletion tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ test_bundle() {
-e "NPM_INSTALL_OPTIONS=--no-bin-links" \
-e "NODE_TLS_REJECT_UNAUTHORIZED=0" \
-e "npm_config_strict_ssl=false" \
$EXTRA_DOCKER_ARGS \
-p 3000:3000 \
-d \
--name meteor-docker-test \
Expand Down Expand Up @@ -172,6 +173,21 @@ test_version() {
verify
}

# UWS requires a newer glibc version. Make sure it works with the base image.
# Reuses the app created by the previous test_version call
# TODO: create new app
test_uws_transport() {
echo "=> Testing uws DDP transport"
build_app
EXTRA_DOCKER_ARGS="-e DDP_TRANSPORT=uws" test_bundle
verify
}

test_latest() {
test_version
test_uws_transport
}

test_versions() {
echo "--- Testing Docker Image $DOCKER_IMAGE ---"

Expand Down Expand Up @@ -201,7 +217,9 @@ test_versions() {
test_version "--release=2.13.3"

# Latest version
test_version
test_latest
elif [[ "$METEOR_TEST_OPTION" == "latest" ]]; then
test_latest
else
test_version "$METEOR_TEST_OPTION"
fi
Expand All @@ -218,4 +236,10 @@ test_versions

DOCKER_IMAGE="zodern/meteor:root"
NPM_OPTIONS="--unsafe-perm"

if [[ -z ${METEOR_TEST_OPTION+x} || "$METEOR_TEST_OPTION" == "latest" ]]; then
echo "=> Checking phantomjs"
docker run --rm --entrypoint phantomjs "$DOCKER_IMAGE" --version
fi

test_versions
Loading