From 4ae7b8eac809227a13be9e25fd602e7a22b02959 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Tue, 13 Apr 2021 23:04:40 +0200 Subject: [PATCH] Fix Dockerfile for devcontainer (#17447) --- .devcontainer/devcontainer.json | 12 +++++++++--- Dockerfile | 16 +++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 53ae8b5a44a1..8c9a336662c3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,13 @@ { "name": "home-assistant.io", - "context": "..", - "dockerFile": "../Dockerfile", + "build": { + "dockerfile": "../Dockerfile", + "context": "..", + "args": { + "VARIANT": "2.6", + "NODE_VERSION": "12.1", + } + }, "appPort": [4000], "postCreateCommand": "bundle install && npm install", "containerEnv": {"DEVCONTAINER": "true"}, @@ -21,4 +27,4 @@ "errorLens.enabledDiagnosticLevels": ["error", "warning"], "terminal.integrated.shell.linux": "/usr/bin/zsh", } -} +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 445458446aaf..a5c00fa85ad9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,8 @@ -ARG VARIANT=2.6 +ARG VARIANT=2 FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} -# Install node -COPY .nvmrc /tmp/.nvmrc -RUN \ - su vscode -c \ - "source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1" +ARG NODE_VERSION="lts/*" +RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1" # Locale env vars ENV \ @@ -19,11 +16,8 @@ RUN \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ ack \ && echo "en_US UTF-8" > /etc/locale.gen \ - && locale-gen en_US.UTF-8 \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* + && locale-gen en_US.UTF-8 # Install the specific version of bundler we need COPY Gemfile.lock ./ -RUN gem install bundler -v `awk 'c&&c--;/BUNDLED WITH/{c=1}' Gemfile.lock` +RUN gem install bundler -v `awk 'c&&c--;/BUNDLED WITH/{c=1}' Gemfile.lock` \ No newline at end of file