Skip to content

Commit ec5a3ed

Browse files
Added nodejs from official nodejs source, installing npm again
1 parent d3a61b1 commit ec5a3ed

File tree

2 files changed

+348
-3
lines changed

2 files changed

+348
-3
lines changed

Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,26 @@ MAINTAINER Sebastian Weisgerber <weisgerber@cispa.saarland>
77
ENV LANG=C.UTF-8
88

99
RUN \
10+
apt-get update &&\
11+
curl -sL http://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - &&\
12+
echo "deb http://deb.nodesource.com/node_8.x stretch main" > /etc/apt/sources.list.d/nodesource.list &&\
13+
echo "deb-src http://deb.nodesource.com/node_8.x stretch main" >> /etc/apt/sources.list.d/nodesource.list &&\
1014
apt-get update && \
1115
apt-get install -y \
16+
build-essential \
17+
curl \
1218
libffi-dev \
1319
libpq-dev \
1420
ca-certificates \
1521
subversion \
1622
imagemagick \
17-
nodejs \
1823
python3 \
19-
nodejs && \
20-
ln -s /usr/bin/nodejs /usr/bin/node
24+
nodejs \
25+
npm
26+
27+
# ln -s /usr/bin/nodejs /usr/bin/node
28+
29+
2130

2231
ENV RACK_ENV="production" \
2332
RAILS_ENV="production"

looky.txt

Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
#!/bin/bash
2+
3+
# Discussion, issues and change requests at:
4+
# https://github.com/nodesource/distributions
5+
#
6+
# Script to install the NodeSource Node.js v8.x repo onto a
7+
# Debian or Ubuntu system.
8+
#
9+
# Run as root or insert `sudo -E` before `bash`:
10+
#
11+
# curl -sL https://deb.nodesource.com/setup_8.x | bash -
12+
# or
13+
# wget -qO- https://deb.nodesource.com/setup_8.x | bash -
14+
#
15+
16+
export DEBIAN_FRONTEND=noninteractive
17+
SCRSUFFIX="_8.x"
18+
NODENAME="Node.js v8.x"
19+
NODEREPO="node_8.x"
20+
NODEPKG="nodejs"
21+
22+
print_status() {
23+
echo
24+
echo "## $1"
25+
echo
26+
}
27+
28+
if test -t 1; then # if terminal
29+
ncolors=$(which tput > /dev/null && tput colors) # supports color
30+
if test -n "$ncolors" && test $ncolors -ge 8; then
31+
termcols=$(tput cols)
32+
bold="$(tput bold)"
33+
underline="$(tput smul)"
34+
standout="$(tput smso)"
35+
normal="$(tput sgr0)"
36+
black="$(tput setaf 0)"
37+
red="$(tput setaf 1)"
38+
green="$(tput setaf 2)"
39+
yellow="$(tput setaf 3)"
40+
blue="$(tput setaf 4)"
41+
magenta="$(tput setaf 5)"
42+
cyan="$(tput setaf 6)"
43+
white="$(tput setaf 7)"
44+
fi
45+
fi
46+
47+
print_bold() {
48+
title="$1"
49+
text="$2"
50+
51+
echo
52+
echo "${red}================================================================================${normal}"
53+
echo "${red}================================================================================${normal}"
54+
echo
55+
echo -e " ${bold}${yellow}${title}${normal}"
56+
echo
57+
echo -en " ${text}"
58+
echo
59+
echo "${red}================================================================================${normal}"
60+
echo "${red}================================================================================${normal}"
61+
}
62+
63+
bail() {
64+
echo 'Error executing command, exiting'
65+
exit 1
66+
}
67+
68+
exec_cmd_nobail() {
69+
echo "+ $1"
70+
bash -c "$1"
71+
}
72+
73+
exec_cmd() {
74+
exec_cmd_nobail "$1" || bail
75+
}
76+
77+
node_deprecation_warning() {
78+
if [[ "X${NODENAME}" == "Xio.js v1.x" ||
79+
"X${NODENAME}" == "Xio.js v2.x" ||
80+
"X${NODENAME}" == "Xio.js v3.x" ||
81+
"X${NODENAME}" == "XNode.js v5.x" ]]; then
82+
83+
print_bold \
84+
" DEPRECATION WARNING " "\
85+
${bold}${NODENAME} is no longer actively supported!${normal}
86+
87+
${bold}You will not receive security or critical stability updates${normal} for this version.
88+
89+
You should migrate to a supported version of Node.js as soon as possible.
90+
Use the installation script that corresponds to the version of Node.js you
91+
wish to install. e.g.
92+
93+
* ${green}https://deb.nodesource.com/setup_4.x — Node.js v4 LTS \"Argon\"${normal} (recommended)
94+
* ${green}https://deb.nodesource.com/setup_6.x — Node.js v6 Current${normal}
95+
96+
Please see ${bold}https://github.com/nodejs/LTS/${normal} for details about which version
97+
may be appropriate for you.
98+
99+
The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
100+
information about which versions of Node.js and which Linux distributions
101+
are supported and how to use the install scripts.
102+
${bold}https://github.com/nodesource/distributions${normal}
103+
"
104+
echo
105+
echo "Continuing in 10 seconds ..."
106+
echo
107+
sleep 10
108+
109+
elif [ "X${NODENAME}" == "XNode.js v0.10" ]; then
110+
111+
print_bold \
112+
" NODE.JS v0.10 DEPRECATION WARNING " "\
113+
Node.js v0.10 will cease to be actively supported in ${bold}October 2016${normal}.
114+
115+
This means you will not continue to receive security or critical stability
116+
updates for this version of Node.js beyond that time.
117+
118+
You should begin migration to a newer version of Node.js as soon as
119+
possible. Use the installation script that corresponds to the version of
120+
Node.js you wish to install. e.g.
121+
122+
* ${green}https://deb.nodesource.com/setup_4.x — Node.js v4 LTS \"Argon\"${normal} (recommended)
123+
* ${green}https://deb.nodesource.com/setup_6.x — Node.js v6 Current${normal}
124+
125+
Please see ${bold}https://github.com/nodejs/LTS/${normal} for details about which version
126+
may be appropriate for you.
127+
128+
The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
129+
information about which versions of Node.js and which Linux distributions
130+
are supported and how to use the install scripts.
131+
${bold}https://github.com/nodesource/distributions${normal}
132+
"
133+
134+
echo
135+
echo "Continuing in 5 seconds ..."
136+
echo
137+
sleep 5
138+
139+
elif [ "X${NODENAME}" == "XNode.js v0.12" ]; then
140+
141+
print_bold \
142+
" NODE.JS v0.12 DEPRECATION WARNING " "\
143+
Node.js v0.12 will cease to be actively supported ${bold}at the end of 2016${normal}.
144+
145+
This means you will not continue to receive security or critical stability
146+
updates for this version of Node.js beyond that time.
147+
148+
You should begin migration to a newer version of Node.js as soon as
149+
possible. Use the installation script that corresponds to the version of
150+
Node.js you wish to install. e.g.
151+
152+
* ${green}https://deb.nodesource.com/setup_4.x — Node.js v4 LTS \"Argon\"${normal} (recommended)
153+
* ${green}https://deb.nodesource.com/setup_6.x — Node.js v6 Current${normal}
154+
155+
Please see ${bold}https://github.com/nodejs/LTS/${normal} for details about which version
156+
may be appropriate for you.
157+
158+
The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
159+
information about which versions of Node.js and which Linux distributions
160+
are supported and how to use the install scripts.
161+
${bold}https://github.com/nodesource/distributions${normal}
162+
"
163+
164+
echo
165+
echo "Continuing in 3 seconds ..."
166+
echo
167+
sleep 3
168+
169+
fi
170+
}
171+
172+
script_deprecation_warning() {
173+
if [ "X${SCRSUFFIX}" == "X" ]; then
174+
print_bold \
175+
" SCRIPT DEPRECATION WARNING " "\
176+
This script, located at ${bold}https://deb.nodesource.com/setup${normal}, used to
177+
install Node.js v0.10, is being deprecated and will eventually be made
178+
inactive.
179+
180+
You should use the script that corresponds to the version of Node.js you
181+
wish to install. e.g.
182+
183+
* ${green}https://deb.nodesource.com/setup_4.x — Node.js v4 LTS \"Argon\"${normal} (recommended)
184+
* ${green}https://deb.nodesource.com/setup_6.x — Node.js v6 Current${normal}
185+
186+
Please see ${bold}https://github.com/nodejs/LTS/${normal} for details about which version
187+
may be appropriate for you.
188+
189+
The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
190+
information about which versions of Node.js and which Linux distributions
191+
are supported and how to use the install scripts.
192+
${bold}https://github.com/nodesource/distributions${normal}
193+
"
194+
195+
echo
196+
echo "Continuing in 10 seconds (press Ctrl-C to abort) ..."
197+
echo
198+
sleep 10
199+
fi
200+
}
201+
202+
setup() {
203+
204+
script_deprecation_warning
205+
206+
print_status "Installing the NodeSource ${NODENAME} repo..."
207+
208+
if $(uname -m | grep -Eq ^armv6); then
209+
print_status "You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js v4 and later."
210+
exit 1
211+
fi
212+
213+
PRE_INSTALL_PKGS=""
214+
215+
# Check that HTTPS transport is available to APT
216+
# (Check snaked from: https://get.docker.io/ubuntu/)
217+
218+
if [ ! -e /usr/lib/apt/methods/https ]; then
219+
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https"
220+
fi
221+
222+
if [ ! -x /usr/bin/lsb_release ]; then
223+
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
224+
fi
225+
226+
if [ ! -x /usr/bin/curl ] && [ ! -x /usr/bin/wget ]; then
227+
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} curl"
228+
fi
229+
230+
# Populating Cache
231+
print_status "Populating apt-get cache..."
232+
exec_cmd 'apt-get update'
233+
234+
if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then
235+
print_status "Installing packages required for setup:${PRE_INSTALL_PKGS}..."
236+
# This next command needs to be redirected to /dev/null or the script will bork
237+
# in some environments
238+
exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1"
239+
fi
240+
241+
IS_PRERELEASE=$(lsb_release -d | grep 'Ubuntu .*development' >& /dev/null; echo $?)
242+
if [[ $IS_PRERELEASE -eq 0 ]]; then
243+
print_status "Your distribution, identified as \"$(lsb_release -d -s)\", is a pre-release version of Ubuntu. NodeSource does not maintain official support for Ubuntu versions until they are formally released. You can try using the manual installation instructions available at https://github.com/nodesource/distributions and use the latest supported Ubuntu version name as the distribution identifier, although this is not guaranteed to work."
244+
exit 1
245+
fi
246+
247+
DISTRO=$(lsb_release -c -s)
248+
249+
check_alt() {
250+
if [ "X${DISTRO}" == "X${2}" ]; then
251+
echo
252+
echo "## You seem to be using ${1} version ${DISTRO}."
253+
echo "## This maps to ${3} \"${4}\"... Adjusting for you..."
254+
DISTRO="${4}"
255+
fi
256+
}
257+
258+
check_alt "Kali" "sana" "Debian" "jessie"
259+
check_alt "Kali" "kali-rolling" "Debian" "jessie"
260+
check_alt "Linux Mint" "maya" "Ubuntu" "precise"
261+
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
262+
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
263+
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
264+
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
265+
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial"
266+
check_alt "Linux Mint" "serena" "Ubuntu" "xenial"
267+
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial"
268+
check_alt "Linux Mint" "sylvia" "Ubuntu" "xenial"
269+
check_alt "LMDE" "betsy" "Debian" "jessie"
270+
check_alt "elementaryOS" "luna" "Ubuntu" "precise"
271+
check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
272+
check_alt "elementaryOS" "loki" "Ubuntu" "xenial"
273+
check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
274+
check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
275+
check_alt "BOSS" "anokha" "Debian" "wheezy"
276+
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
277+
check_alt "Tanglu" "chromodoris" "Debian" "jessie"
278+
279+
if [ "X${DISTRO}" == "Xdebian" ]; then
280+
print_status "Unknown Debian-based distribution, checking /etc/debian_version..."
281+
NEWDISTRO=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version)
282+
if [ "X${NEWDISTRO}" == "X" ]; then
283+
print_status "Could not determine distribution from /etc/debian_version..."
284+
else
285+
DISTRO=$NEWDISTRO
286+
print_status "Found \"${DISTRO}\" in /etc/debian_version..."
287+
fi
288+
fi
289+
290+
print_status "Confirming \"${DISTRO}\" is supported..."
291+
292+
if [ -x /usr/bin/curl ]; then
293+
exec_cmd_nobail "curl -sLf -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'"
294+
RC=$?
295+
else
296+
exec_cmd_nobail "wget -qO /dev/null -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'"
297+
RC=$?
298+
fi
299+
300+
if [[ $RC != 0 ]]; then
301+
print_status "Your distribution, identified as \"${DISTRO}\", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support"
302+
exit 1
303+
fi
304+
305+
if [ -f "/etc/apt/sources.list.d/chris-lea-node_js-$DISTRO.list" ]; then
306+
print_status 'Removing Launchpad PPA Repository for NodeJS...'
307+
308+
exec_cmd_nobail 'add-apt-repository -y -r ppa:chris-lea/node.js'
309+
exec_cmd "rm -f /etc/apt/sources.list.d/chris-lea-node_js-${DISTRO}.list"
310+
fi
311+
312+
print_status 'Adding the NodeSource signing key to your keyring...'
313+
314+
if [ -x /usr/bin/curl ]; then
315+
exec_cmd 'curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -'
316+
else
317+
exec_cmd 'wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -'
318+
fi
319+
320+
print_status "Creating apt sources list file for the NodeSource ${NODENAME} repo..."
321+
322+
exec_cmd "echo 'deb https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' > /etc/apt/sources.list.d/nodesource.list"
323+
exec_cmd "echo 'deb-src https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' >> /etc/apt/sources.list.d/nodesource.list"
324+
325+
print_status 'Running `apt-get update` for you...'
326+
327+
exec_cmd 'apt-get update'
328+
329+
node_deprecation_warning
330+
331+
print_status "Run \`apt-get install ${NODEPKG}\` (as root) to install ${NODENAME} and npm"
332+
333+
}
334+
335+
## Defer setup until we have the complete script
336+
setup

0 commit comments

Comments
 (0)