frandallfarmer / neohabitat

Repository for the NeoClassical Habitat Server Project
http://neohabitat.org
MIT License
228 stars 42 forks source link

Dockerfile Node.JS installation script deprecated #437

Open StuBlad opened 11 months ago

StuBlad commented 11 months ago

When attempting to setup a fresh NeoHabitat instance using Docker, the build fails when you get to the part where we attempt to install Node.JS.

This line from the Dockerfile in particular is where it will die: curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -

When you run this command, you'll get this output:

================================================================================
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
================================================================================
                           SCRIPT DEPRECATION WARNING                    

  This script, located at https://deb.nodesource.com/setup_X, used to
  install Node.js is deprecated now and will eventually be made inactive.
  Please visit the NodeSource distributions Github and follow the
  instructions to migrate your repo.
  https://github.com/nodesource/distributions
  The NodeSource Node.js Linux distributions GitHub repository contains
  information about which versions of Node.js and which Linux distributions
  are supported and how to install it.
  https://github.com/nodesource/distributions
                          SCRIPT DEPRECATION WARNING
================================================================================
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
================================================================================
TO AVOID THIS WAIT MIGRATE THE SCRIPT
Continuing in 60 seconds (press Ctrl-C to abort) ...

If you head to the NodeSource distribution Github repo as mentioned above, you'll see the instructions for installing via this method have changed to the following commands:

curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh
chmod 500 nsolid_setup_rpm.sh
./nsolid_setup_rpm.sh 18
yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1

This command is meant to install Node.JS version 18.

If you add this into the Dockerfile by commenting the original line out and prefixing each of the above lines with RUN, the Docker compose setup will continue on past the point of failure and begin to install the base build dependencies on the next line of the Dockerfile.

However, it gets to the following line and then stalls to infinity and I cannot get it to proceed past this point:

 => [neohabitat  5/15] RUN yum -y install   cronie   git   java-1.8.0-openjdk   make   mariadb   vim   wget   which   maven   mongodb-o  126.5s
 => => # Running transaction check
 => => # Transaction check succeeded.
 => => # Running transaction test
 => => # Transaction test succeeded.
 => => # Running transaction
 => => #   Running scriptlet: npm-1:6.14.10-1.10.23.1.1.module_el8.4.0+645+9ce14ba   1/1
frandallfarmer commented 11 months ago

NOTE: As of today, if you just wait the 60 seconds the build will proceed and, in my case, complete successfully.

This issue is staying open because it DOES need to be addressed.

AmandaJonesAway commented 11 months ago

If you add this into the Dockerfile by commenting the original line out and prefixing each of the above lines with RUN, the Docker compose setup will continue

This doesn't work. Each RUN is counted as a separate process. Just replace the original curl with the new commands, but terminate each line with \ and put && at the start of the next line. This keeps each line within the same process. (I'm not able to test this at the moment, as I'm away from home, but that is probably all it needs.)

StuBlad commented 11 months ago

I changed the Dockerfile to this:

# Get a recent version of nodejs
# RUN curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
RUN curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh \ 
&& chmod 500 nsolid_setup_rpm.sh \ 
&& ./nsolid_setup_rpm.sh 18 \ 
&& yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1

It performed the same way as doing the RUN on each line and for my own WSL2 setup, still hangs on the line:

 => => # Running transaction check
 => => # Transaction check succeeded.
 => => # Running transaction test
 => => # Transaction test succeeded.
 => => # Running transaction
 => => #   Running scriptlet: npm-1:6.14.10-1.10.23.1.1.module_el8.4.0+645+9ce14ba   1/1

If anyone else who sees this is able to try this on a non WSL2 machine, please let us know if it does this for you too.