From d703d0a94f9259767797b84ca9267fb40fe4c661 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 4 Feb 2021 11:24:51 +0100 Subject: [PATCH] Use Microsoft devcontainer base (#16407) --- .devcontainer/devcontainer.json | 4 ++-- .devcontainer/Dockerfile => Dockerfile | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) rename .devcontainer/Dockerfile => Dockerfile (62%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e19189152ea..04770dc73f4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,8 +1,8 @@ { "name": "home-assistant.io", - "dockerFile": "Dockerfile", + "dockerFile": "../Dockerfile", "appPort": [4000], - "postCreateCommand": "bundle install", + "postCreateCommand": "bundle install && npm install", "extensions": [ "davidanson.vscode-markdownlint", "editorconfig.editorconfig", diff --git a/.devcontainer/Dockerfile b/Dockerfile similarity index 62% rename from .devcontainer/Dockerfile rename to Dockerfile index e041b33ae3c..ef347e9e031 100644 --- a/.devcontainer/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM ruby:2.6 +ARG VARIANT=2.6 +FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# Use Bash as the default shell -ENV SHELL=/bin/bash +# Install node +COPY .nvmrc /tmp/.nvmrc +RUN \ + su vscode -c \ + "source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1" # Set an environment variable to be able to detect we are in dev container ENV DEVCONTAINER=true @@ -16,7 +17,7 @@ ENV \ LC_ALL=en_US.UTF-8 # Install git, process tools -RUN apt update \ +RUN apt update && export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y --no-install-recommends \ ack \ git \ @@ -30,7 +31,5 @@ RUN apt update \ && rm -rf /var/lib/apt/lists/* # Install the specific version of bundler we need -RUN gem install bundler -v 2.0.1 - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog +COPY Gemfile.lock ./ +RUN gem install bundler -v `awk 'c&&c--;/BUNDLED WITH/{c=1}' Gemfile.lock`