Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit a2fe083

Browse files
chore(node): Upgrade to node lts
Upgrading the docker build and nvm to node 20.18, which is the latest supported, stable LTS version. Node 12 and 16 have been EoL since April, 2022 and August, 2023, respectively. In addition, a transitive dependency of mjml, minimatch, is not compatible with anything less than node 14 at this point, so email generation from templates was broken. With the move to newer node, I had to deal with a new node/docker restriction which won't allow you to `npm install` in the root directory. I wanted to maintain backwards compatiblity with current installs and their MJML_PATH parameter, so I worked around the problem by installing mjml in another directory and then moving node_modules to the root directory. It's not pretty, but it worked. I'm trying to run tests locally and I get one failure, but I'm not sure if it's my setup or something I need to correct. I've manually tested the setup, gone into every page, and not experienced problems.
1 parent 0997901 commit a2fe083

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.13.0
1+
20.18.0

docker/Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
8787
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
8888
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
8989

90-
RUN wget --quiet -O - https://deb.nodesource.com/setup_12.x | bash -
90+
RUN wget --quiet -O - https://deb.nodesource.com/setup_16.x | bash -
9191

9292
COPY --from=sdist /dist/*.whl /tmp/dist/
9393
RUN buildDeps="" \
@@ -104,7 +104,21 @@ RUN buildDeps="" \
104104
pkg-config postgresql-client-14 nodejs \
105105
&& apt-get clean \
106106
&& rm -rf /var/lib/apt/lists/* \
107-
&& npm install mjml --no-cache-dir
107+
# mjml has to be installed differently here because
108+
# after node 14, docker will install npm files at the
109+
# root directoy and fail, so we have to create a new
110+
# directory and use it for the install then copy the
111+
# files to the root directory to maintain backwards
112+
# compatibility for email generation
113+
&& mkdir -p /mjml_install \
114+
# if our workdir is /, then pushd/popd doesn't work
115+
# for the npm install. It still tries to install in /,
116+
# which npm can't do
117+
&& cd /mjml_install \
118+
&& npm install --no-cache-dir mjml \
119+
&& mv node_modules / \
120+
&& cd / \
121+
&& rm -rf /mjml_install
108122

109123
EXPOSE 8000
110124
VOLUME /var/lib/dispatch/files

0 commit comments

Comments
 (0)