From 27600c410ed96715ce3086cfa389c29688493cbe Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Fri, 7 Jun 2019 16:23:02 +0100 Subject: [PATCH 1/7] refactor file to take better account of layers. --- .../.devcontainer/Dockerfile | 31 ++++++------------- .../.devcontainer/Dockerfile | 30 ++++++------------ 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/containers/javascript-node-lts/.devcontainer/Dockerfile b/containers/javascript-node-lts/.devcontainer/Dockerfile index a9faaa3afe..4c26e27f87 100644 --- a/containers/javascript-node-lts/.devcontainer/Dockerfile +++ b/containers/javascript-node-lts/.devcontainer/Dockerfile @@ -5,33 +5,22 @@ FROM node:lts -# Configure apt ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils 2>&1 - -# Verify git and needed tools are installed -RUN apt-get install -y git procps +ENV DEBIAN_FRONTEND=dialog +ENV SHELL /bin/bash -# Remove outdated yarn from /opt and install via package -# so it can be easily updated via apt-get upgrade yarn -RUN rm -rf /opt/yarn-* \ +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 \ + && apt-get install -y git procps \ + && rm -rf /opt/yarn-* \ && rm -f /usr/local/bin/yarn \ && rm -f /usr/local/bin/yarnpkg \ && apt-get install -y curl apt-transport-https lsb-release \ && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ - && apt-get -y install --no-install-recommends yarn - -# Install eslint -RUN npm install -g eslint - -# Clean up -RUN apt-get autoremove -y \ + && apt-get -y install --no-install-recommends yarn \ + && npm install -g eslint \ + && apt-get autoremove -y \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* -ENV DEBIAN_FRONTEND=dialog - -# Set the default shell to bash instead of sh -ENV SHELL /bin/bash \ No newline at end of file + && rm -rf /var/lib/apt/lists/* \ diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index 46a3bd5a8b..138b98993a 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -7,31 +7,21 @@ FROM node:8 # Configure apt ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils 2>&1 - -# Verify git and needed tools are installed -RUN apt-get install -y git procps +ENV DEBIAN_FRONTEND=dialog +ENV SHELL /bin/bash -# Remove outdated yarn from /opt and install via package -# so it can be easily updated via apt-get upgrade yarn -RUN rm -rf /opt/yarn-* \ +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 \ + && apt-get install -y git procps \ + && rm -rf /opt/yarn-* \ && rm -f /usr/local/bin/yarn \ && rm -f /usr/local/bin/yarnpkg \ && apt-get install -y curl apt-transport-https lsb-release \ && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ - && apt-get -y install --no-install-recommends yarn - -# Install tslint and typescript -RUN npm install -g tslint typescript - -# Clean up -RUN apt-get autoremove -y \ + && apt-get -y install --no-install-recommends yarn \ + && npm install -g tslint typescript \ + && apt-get autoremove -y \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* -ENV DEBIAN_FRONTEND=dialog - -# Set the default shell to bash instead of sh -ENV SHELL /bin/bash \ No newline at end of file + && rm -rf /var/lib/apt/lists/* \ No newline at end of file From 084809623d0aa79f8ceec99f797f9ab9fa1fdb51 Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Fri, 7 Jun 2019 17:06:11 +0100 Subject: [PATCH 2/7] moved front end to the end where it should be --- containers/typescript-node-8/.devcontainer/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index 138b98993a..670d5a6232 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -7,7 +7,6 @@ FROM node:8 # Configure apt ENV DEBIAN_FRONTEND=noninteractive -ENV DEBIAN_FRONTEND=dialog ENV SHELL /bin/bash RUN apt-get update \ @@ -24,4 +23,6 @@ RUN apt-get update \ && npm install -g tslint typescript \ && apt-get autoremove -y \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* \ No newline at end of file + && rm -rf /var/lib/apt/lists/* + +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file From 0aa87652f4a677162ccd3e0607b58853ea914d41 Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Sat, 8 Jun 2019 17:48:10 +0100 Subject: [PATCH 3/7] put commends back inline to help demonstrate what commands mean --- containers/typescript-node-8/.devcontainer/Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index 670d5a6232..f880bb2164 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -7,11 +7,17 @@ FROM node:8 # Configure apt ENV DEBIAN_FRONTEND=noninteractive + +# Set the default shell to bash instead of sh ENV SHELL /bin/bash + RUN apt-get update \ && apt-get -y install --no-install-recommends apt-utils 2>&1 \ - && apt-get install -y git procps \ + # Verify git and needed tools are installed + && apt-get install -y git procps \ + # Remove outdated yarn from /opt and install via package + # so it can be easily updated via apt-get upgrade yarn && rm -rf /opt/yarn-* \ && rm -f /usr/local/bin/yarn \ && rm -f /usr/local/bin/yarnpkg \ @@ -20,7 +26,9 @@ RUN apt-get update \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ && apt-get -y install --no-install-recommends yarn \ + # Install tslint and typescript && npm install -g tslint typescript \ + # Clean up && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* From 7db43f841bed333bb8fea82f7fc4156b5e6edcaf Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Sat, 8 Jun 2019 19:19:46 +0100 Subject: [PATCH 4/7] placed comments back in and continue with layers that are more optimal as suggested. --- .../.devcontainer/Dockerfile | 1 - .../.devcontainer/Dockerfile | 31 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index f880bb2164..4e17cbcdb2 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -11,7 +11,6 @@ ENV DEBIAN_FRONTEND=noninteractive # Set the default shell to bash instead of sh ENV SHELL /bin/bash - RUN apt-get update \ && apt-get -y install --no-install-recommends apt-utils 2>&1 \ # Verify git and needed tools are installed diff --git a/containers/typescript-node-lts/.devcontainer/Dockerfile b/containers/typescript-node-lts/.devcontainer/Dockerfile index dfb8c6b062..3686104a59 100644 --- a/containers/typescript-node-lts/.devcontainer/Dockerfile +++ b/containers/typescript-node-lts/.devcontainer/Dockerfile @@ -5,33 +5,32 @@ FROM node:lts -# Configure apt ENV DEBIAN_FRONTEND=noninteractive + +# Set the default shell to bash instead of sh +ENV SHELL /bin/bash + +# Configure apt RUN apt-get update \ && apt-get -y install --no-install-recommends apt-utils 2>&1 # Verify git and needed tools are installed -RUN apt-get install -y git procps - -# Remove outdated yarn from /opt and install via package -# so it can be easily updated via apt-get upgrade yarn -RUN rm -rf /opt/yarn-* \ +RUN apt-get install -y git procps \ + # Remove outdated yarn from /opt and install via package + # so it can be easily updated via apt-get upgrade yarn + && rm -rf /opt/yarn-* \ && rm -f /usr/local/bin/yarn \ && rm -f /usr/local/bin/yarnpkg \ && apt-get install -y curl apt-transport-https lsb-release \ && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ - && apt-get -y install --no-install-recommends yarn - -# Install tslint and typescript -RUN npm install -g tslint typescript - -# Clean up -RUN apt-get autoremove -y \ + && apt-get -y install --no-install-recommends yarn \ + # Install tslint and typescript + && npm install -g tslint typescript \ + # Clean up + && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -ENV DEBIAN_FRONTEND=dialog -# Set the default shell to bash instead of sh -ENV SHELL /bin/bash \ No newline at end of file +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file From 963ef571083471364eacdadf1b284365264c251f Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Sat, 8 Jun 2019 19:23:03 +0100 Subject: [PATCH 5/7] added the word 'globally' to better clarify the npm install statement for tslint and typescript --- containers/typescript-node-8/.devcontainer/Dockerfile | 2 +- containers/typescript-node-lts/.devcontainer/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index 4e17cbcdb2..c0a6b1d75b 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -25,7 +25,7 @@ RUN apt-get update \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ && apt-get -y install --no-install-recommends yarn \ - # Install tslint and typescript + # Install tslint and typescript globally && npm install -g tslint typescript \ # Clean up && apt-get autoremove -y \ diff --git a/containers/typescript-node-lts/.devcontainer/Dockerfile b/containers/typescript-node-lts/.devcontainer/Dockerfile index 3686104a59..715b17f542 100644 --- a/containers/typescript-node-lts/.devcontainer/Dockerfile +++ b/containers/typescript-node-lts/.devcontainer/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get install -y git procps \ && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update \ && apt-get -y install --no-install-recommends yarn \ - # Install tslint and typescript + # Install tslint and typescript globally && npm install -g tslint typescript \ # Clean up && apt-get autoremove -y \ From bd662182855ac039ea4ab1c278c2f080d49fa7bb Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Sat, 8 Jun 2019 19:24:33 +0100 Subject: [PATCH 6/7] changed apt update to inline in run statement --- containers/typescript-node-lts/.devcontainer/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/containers/typescript-node-lts/.devcontainer/Dockerfile b/containers/typescript-node-lts/.devcontainer/Dockerfile index 715b17f542..65746bd2db 100644 --- a/containers/typescript-node-lts/.devcontainer/Dockerfile +++ b/containers/typescript-node-lts/.devcontainer/Dockerfile @@ -12,10 +12,9 @@ ENV SHELL /bin/bash # Configure apt RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils 2>&1 - -# Verify git and needed tools are installed -RUN apt-get install -y git procps \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 \ + # Verify git and needed tools are installed + && apt-get install -y git procps \ # Remove outdated yarn from /opt and install via package # so it can be easily updated via apt-get upgrade yarn && rm -rf /opt/yarn-* \ From ba1060e5dec38eccb43ec0ed3112ab7c92fb1d22 Mon Sep 17 00:00:00 2001 From: Krystan Honour Date: Sat, 8 Jun 2019 19:25:23 +0100 Subject: [PATCH 7/7] corrected positioning of comment --- containers/typescript-node-8/.devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/typescript-node-8/.devcontainer/Dockerfile b/containers/typescript-node-8/.devcontainer/Dockerfile index c0a6b1d75b..0142f7a461 100644 --- a/containers/typescript-node-8/.devcontainer/Dockerfile +++ b/containers/typescript-node-8/.devcontainer/Dockerfile @@ -5,12 +5,12 @@ FROM node:8 -# Configure apt ENV DEBIAN_FRONTEND=noninteractive # Set the default shell to bash instead of sh ENV SHELL /bin/bash +# Configure apt RUN apt-get update \ && apt-get -y install --no-install-recommends apt-utils 2>&1 \ # Verify git and needed tools are installed