Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depend on a specific version of Node.js #5158

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next Next commit
Depend on a specific version of Node.js
We're choosing version 18 because if offers support for SSL 3, just
like Ruby 3.1 does.

Note we're symlinking a .nvmrc file as well, in order to make it
compatible with NVM. While the .nvmrc and .node-version files use
different formats, they both support the syntax we're using to
define the version.

The code to install Node.js in the Dockerfile is a simplification of the
code in the Rails Dockerfile template [1].

[1] https://github.com/rails/rails/blob/04c97aec8a/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt#L25
  • Loading branch information
javierm committed Oct 17, 2023
commit 55ed40e1822faa0ebd8200877929b08b769630ef
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
with:
bundler-cache: true
- name: Setup NPM
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version-file: ".node-version"
- name: Copy secrets and database files
run: for i in config/*.example; do cp "$i" "${i/.example}"; done
- name: Setup database
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.0
1 change: 1 addition & 0 deletions .nvmrc
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ RUN apt-get update -qq \
libpq-dev \
libxss1 \
memcached \
nodejs \
pkg-config \
postgresql-client \
shared-mime-info \
Expand All @@ -28,7 +27,7 @@ RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
&& adduser consul sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path
RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin:/usr/local/node/bin"' > /etc/sudoers.d/secure_path
RUN chmod 0440 /etc/sudoers.d/secure_path

# Define where our application will live inside the image
Expand All @@ -40,6 +39,13 @@ RUN mkdir -p $RAILS_ROOT/tmp/pids
# Set our working directory inside the image
WORKDIR $RAILS_ROOT

# Install Node
COPY .node-version ./
ENV PATH=/usr/local/node/bin:$PATH
javierm marked this conversation as resolved.
Show resolved Hide resolved
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build `cat .node-version` /usr/local/node && \
rm -rf /tmp/node-build-master

# Use the Gemfiles as Docker cache markers. Always bundle before copying app src.
# (the src likely changed and we don't want to invalidate Docker's cache too early)
COPY Gemfile* ./
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You can access the main website of the project at [http:https://consuldemocracy.org](h

**NOTE**: For more detailed instructions check the [docs](https://docs.consuldemocracy.org)

Prerequisites: install git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js and PostgreSQL (>=9.5).
Prerequisites: install git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js 18.18.0 and PostgreSQL (>=9.5).

```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git
Expand Down
2 changes: 1 addition & 1 deletion README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Puedes acceder a la página principal del proyecto en [http:https://consuldemocracy.or

**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://docs.consuldemocracy.org)

Prerequisitos: tener instalado git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js y PostgreSQL (9.5 o superior).
Prerequisitos: tener instalado git, Ruby 3.1.4, CMake, pkg-config, shared-mime-info, Node.js 18.18.0 y PostgreSQL (9.5 o superior).

```bash
git clone https://github.com/consuldemocracy/consuldemocracy.git
Expand Down