From 6952af137d17f65e65963e4d9ba129060fad9d3d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 8 Jun 2024 06:33:28 -0400 Subject: [PATCH] Install from nvmrc during devcontainer Dockerfile build (#30603) --- .devcontainer/Dockerfile | 12 +++++------- .devcontainer/compose.yaml | 4 ++-- bin/setup | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 113dd71880d..c6dcc4d46a3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,17 +1,15 @@ # For details, see https://github.com/devcontainers/images/tree/main/src/ruby FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm -# Update existing node version, keep in sync with .nvmrc -ARG NODE_VERSION="20" -RUN . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1 +# Install node version from .nvmrc +WORKDIR /app +COPY .nvmrc . +RUN /bin/bash --login -i -c "nvm install" # Install additional OS packages RUN apt-get update && \ export DEBIAN_FRONTEND=noninteractive && \ apt-get -y install --no-install-recommends libicu-dev libidn11-dev ffmpeg imagemagick libvips42 libpam-dev -# Install global node packages -RUN . /usr/local/share/nvm/nvm.sh && corepack enable 2>&1 - # Move welcome message to where VS Code expects it -COPY welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt +COPY .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml index 4d6eb3c4879..1e2e1ba7de2 100644 --- a/.devcontainer/compose.yaml +++ b/.devcontainer/compose.yaml @@ -2,8 +2,8 @@ services: app: working_dir: /workspaces/mastodon/ build: - context: . - dockerfile: Dockerfile + context: .. + dockerfile: .devcontainer/Dockerfile volumes: - ..:/workspaces/mastodon:cached environment: diff --git a/bin/setup b/bin/setup index 93c6981d0b5..4ccf4594b4e 100755 --- a/bin/setup +++ b/bin/setup @@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do system('bundle check') || system!('bundle install') puts "\n== Installing JS dependencies ==" - system! 'corepack prepare' + system! 'corepack enable' system! 'bin/yarn install --immutable' puts "\n== Preparing database =="