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

remove nvm #5285

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.10.0
20
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ NOTIFY_CREDENTIALS ?= ~/.notify-credentials
.PHONY: bootstrap
bootstrap: generate-version-file ## Set up everything to run the app
uv pip install -r requirements_for_test.txt
source $(HOME)/.nvm/nvm.sh && nvm install && npm ci --no-audit
. environment.sh; source $(HOME)/.nvm/nvm.sh && npm run build
npm ci --no-audit
. environment.sh; npm run build

.PHONY: bootstrap-with-docker
bootstrap-with-docker: generate-version-file ## Build the image to run the app in Docker
Expand All @@ -35,7 +35,7 @@ run-flask-with-docker: ## Run flask

.PHONY: npm-audit
npm-audit: ## Check for vulnerabilities in NPM packages
source $(HOME)/.nvm/nvm.sh && npm run audit
npm run audit

.PHONY: help
help:
Expand All @@ -49,7 +49,7 @@ generate-version-file: ## Generates the app version file
test: ## Run tests
ruff check .
black --check .
source $(HOME)/.nvm/nvm.sh && npm test
npm test
py.test -n auto --maxfail=10 tests/

.PHONY: watch-tests
Expand Down
19 changes: 7 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ FROM production as test
# If bumping this node version, also bump:
# `.nvmrc` in notifications-admin
# `concourse/docker/unit-tests-image.Dockerfile` in notifications-aws
# Keep NVM_VERSION in sync as well.
ARG NVM_VERSION=0.39.7
ARG NODE_VERSION=20.10.0
ARG NODE_VERSION=20

USER root

Expand All @@ -97,20 +95,17 @@ RUN echo "Install OS dependencies for test build" && \
git && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* /tmp/*

RUN \
echo "Installing Node v${NODE_VERSION}" \
&& curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y nodejs

RUN usermod -aG sudo notify
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER notify

ENV HOME=/home/vcap
ENV NVM_DIR /home/vcap/.nvm
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

COPY .nvmrc .nvmrc
RUN echo "Installing nvm and NodeJS v${NODE_VERSION}" && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash && \
. ${NVM_DIR}/nvm.sh && \
nvm install

# Copying to overwrite is faster than RUN chown notify:notify ...
COPY --from=python_build --chown=notify:notify /opt/venv /opt/venv
Expand Down