diff --git a/Dockerfile b/Dockerfile index 8b6b8bb..9540d57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM phusion/passenger-ruby33:3.0.2 +FROM phusion/passenger-customizable:3.0.2 # Set correct environment variables. ENV HOME /root @@ -9,11 +9,18 @@ CMD ["/sbin/my_init"] RUN apt-get update --assume-yes && apt-get install --assume-yes build-essential # Node.js support -ADD buildconfig /tmp/buildconfig -ADD nodejs.sh /tmp/nodejs.sh -RUN /tmp/nodejs.sh -RUN rm /tmp/buildconfig -RUN rm /tmp/nodejs.sh +# ADD buildconfig /tmp/buildconfig +# ADD nodejs.sh /tmp/nodejs.sh +# RUN /tmp/nodejs.sh 18 +# RUN /tmp/nodejs.sh +# RUN rm /tmp/buildconfig +# RUN rm /tmp/nodejs.sh +RUN /pd_build/nodejs.sh 18 +RUN /pd_build/nodejs.sh 20 + +# Ruby support +RUN /pd_build/ruby-3.2.3.sh +RUN /pd_build/ruby-3.3.0.sh # Yarn support RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ @@ -21,9 +28,9 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ rm -r /var/lib/apt/lists/* && apt-get update && apt-get install yarn # Resolve the issue might caused by node-sass installation issue -ADD linux-x64-83_binding.node /opt/linux-x64-83_binding.node -ADD linux-x64-93_binding.node /opt/linux-x64-93_binding.node -ADD linux-x64-108_binding.node /opt/linux-x64-108_binding.node +# ADD linux-x64-83_binding.node /opt/linux-x64-83_binding.node +# ADD linux-x64-93_binding.node /opt/linux-x64-93_binding.node +# ADD linux-x64-108_binding.node /opt/linux-x64-108_binding.node ADD linux-x64-111_binding.node /opt/linux-x64-111_binding.node ADD linux-x64-115_binding.node /opt/linux-x64-115_binding.node diff --git a/buildconfig b/buildconfig index 07dca25..97c57a9 100644 --- a/buildconfig +++ b/buildconfig @@ -28,6 +28,18 @@ function minimal_apt_get_install() apt-get install -y --no-install-recommends "$@" } +function apt_add_ppa() +{ + add-apt-repository -y $1 + apt-get update +} + +function cleanup_apt() +{ + run apt-get -y clean + run rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/log/dpkg.log /var/log/apt/* +} + function header() { local title="$1" @@ -46,8 +58,11 @@ function create_rvm_wrapper_script() local name="$1" local rvm_id="$2" local command="$3" + + rm -f "/usr/bin/$name" + echo "+ Creating /usr/bin/$name" echo '#!/bin/sh' >> "/usr/bin/$name" echo exec "/usr/local/rvm/wrappers/$rvm_id/$command" '"$@"' >> "/usr/bin/$name" chmod +x "/usr/bin/$name" -} \ No newline at end of file +} diff --git a/nodejs.sh b/nodejs.sh index 9fdde24..7d31d5b 100755 --- a/nodejs.sh +++ b/nodejs.sh @@ -3,14 +3,25 @@ set -e source /tmp/buildconfig set -x -echo "+ Enabling Node Source APT repo" -curl -sL https://deb.nodesource.com/setup_18.x | bash - -apt-get update +VERSION=${1:-20} +if ( ! egrep -q nodesource.gpg /etc/apt/sources.list.d/nodesource.list ); then + ## Install Node.js (also needed for Rails asset compilation) -## Install Node.js (also needed for Rails asset compilation) -minimal_apt_get_install nodejs -echo "+ Updating npm" -run npm update npm -g || ( cat /root/.npm/_logs/*-debug.log && false ) -if [[ ! -e /usr/bin/node ]]; then - ln -s /usr/bin/nodejs /usr/bin/node + header "Installing NodeJS ${VERSION}" + + mkdir -p /etc/apt/keyrings + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --dearmor -o /etc/apt/keyrings/nodesource.gpg + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + apt-get update + + minimal_apt_get_install nodejs + + echo "+ Updating npm" + run npm update npm -g || ( cat /root/.npm/_logs/*-debug.log && false ) + if [[ ! -e /usr/bin/node ]]; then + ln -s /usr/bin/nodejs /usr/bin/node + fi + + ## create corepack command symlinks (yarn, etc) + corepack enable fi \ No newline at end of file