Update to node version 16 (#15522)

* update to node version 16

* Remove canvas compiled node objects

* use f35 testing image as builder/base

* Update production builder base image to use Fedora 35

I missed this (it's not immediately obvious that there are 2 base
images declared in this file, one called builder, one called
production, this seems like it could be refactored to lift that
out (give it a name, a cmd, and do nothing else) `as base` perhaps,
while keeping separate install processes for testing- and pr-/production images.

* Add libpq dependency in production

We need this (if not the -devel header file, at least the library) to
start pg_ext.so

I think this might have been working because of the --cache-from
options when building in the build container script?

* Update .gitpod.dockerfile

* Add temporary cleanup for upgrade to bin/setup

This has the undesirable effect of requiring a yarn reinstall.

It would be better if there were a smart check to confirm the version
of the canvas.node file matched the node version or did not (so we
only do this as needed, rather than on every setup invocation until
this is removed from the code).

* Use check-files rather than force when rebuilding canvas

Optimal situation would be a `rebuild` command in yarn (I believe npm
has this option) to recompile canvas (all that's needed) rather than
fetch, install, and build.

Co-authored-by: Michael Kohl <me@citizen428.net>
This commit is contained in:
Daniel Uber 2022-01-03 10:23:07 -06:00 committed by GitHub
parent 7326744313
commit d03da33ac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 6 deletions

View file

@ -12,7 +12,7 @@ RUN bash -lc "rvm install ruby-$RUBY_VERSION && rvm use ruby-$RUBY_VERSION --def
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc
# Install Node and Yarn
ENV NODE_VERSION=14.17.6
ENV NODE_VERSION=16.13.1
RUN bash -c ". .nvm/nvm.sh && \
nvm install ${NODE_VERSION} && \
nvm alias default ${NODE_VERSION} && \

2
.nvmrc
View file

@ -1 +1 @@
14
16

View file

@ -7,6 +7,8 @@ cache:
bundler: true
directories:
- node_modules
before_cache:
- find node_modules -type f -name "*.node" -delete
rvm:
- 3.0.2
addons:

View file

@ -1,5 +1,4 @@
FROM quay.io/forem/ruby:3.0.2 as base
FROM quay.io/forem/ruby:3.0.2-testing as base
FROM base as builder
@ -58,7 +57,7 @@ USER root
RUN dnf install --setopt install_weak_deps=false -y bash curl ImageMagick \
iproute jemalloc less libcurl \
postgresql tzdata nodejs \
postgresql tzdata nodejs libpq \
&& dnf -y clean all \
&& rm -rf /var/cache/yum

View file

@ -22,6 +22,15 @@ FileUtils.chdir APP_ROOT do
system! "gem list \"^foreman$\" -i --silent || gem install foreman"
# TODO: temporary fix for node 16 upgrade, remove after release as this triggers reinstallation
# of the canvas library (with its extension compiled against the versioned node symbol)
if File.exist?("node_modules/canvas/")
FileUtils.rm_rf("node_modules/canvas/")
# having removed the module ourselves,
# we need to coerce yarn, or remove the .yarn-integrity file
system("yarn install --check-files")
end
# Install JavaScript dependencies if using Yarn
system("bin/yarn")

View file

@ -4,7 +4,7 @@
"description": "Where programmers share ideas and help each other grow",
"engines": {
"yarn": ">=1.21.x",
"node": "14.x"
"node": "16.x"
},
"main": "index.js",
"directories": {