From ca054f1e522ce8f6f9bfb54fd6ff7d54a366c3cc Mon Sep 17 00:00:00 2001 From: Aidan Steele Date: Thu, 4 Aug 2016 11:42:15 +1000 Subject: [PATCH 1/2] Perform nodejs installation before COPY in Dockerfile templates --- templates/Angular2Spa/Dockerfile | 8 +++----- templates/KnockoutSpa/Dockerfile | 8 +++----- templates/ReactReduxSpa/Dockerfile | 8 +++----- templates/ReactSpa/Dockerfile | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/templates/Angular2Spa/Dockerfile b/templates/Angular2Spa/Dockerfile index b382b9ea..748edec0 100644 --- a/templates/Angular2Spa/Dockerfile +++ b/templates/Angular2Spa/Dockerfile @@ -1,14 +1,12 @@ FROM microsoft/dotnet:latest +RUN apt-get update +RUN apt-get install -y build-essential nodejs nodejs-legacy + COPY . /app WORKDIR /app -# Add Node.js to the container. If you don't want to wait for this to install every -# time you rebuild your container, consider creating an image that has it preinstalled. -RUN apt-get update -RUN apt-get install -y build-essential nodejs nodejs-legacy - RUN ["dotnet", "restore"] RUN ["dotnet", "build"] diff --git a/templates/KnockoutSpa/Dockerfile b/templates/KnockoutSpa/Dockerfile index b382b9ea..748edec0 100644 --- a/templates/KnockoutSpa/Dockerfile +++ b/templates/KnockoutSpa/Dockerfile @@ -1,14 +1,12 @@ FROM microsoft/dotnet:latest +RUN apt-get update +RUN apt-get install -y build-essential nodejs nodejs-legacy + COPY . /app WORKDIR /app -# Add Node.js to the container. If you don't want to wait for this to install every -# time you rebuild your container, consider creating an image that has it preinstalled. -RUN apt-get update -RUN apt-get install -y build-essential nodejs nodejs-legacy - RUN ["dotnet", "restore"] RUN ["dotnet", "build"] diff --git a/templates/ReactReduxSpa/Dockerfile b/templates/ReactReduxSpa/Dockerfile index b382b9ea..748edec0 100644 --- a/templates/ReactReduxSpa/Dockerfile +++ b/templates/ReactReduxSpa/Dockerfile @@ -1,14 +1,12 @@ FROM microsoft/dotnet:latest +RUN apt-get update +RUN apt-get install -y build-essential nodejs nodejs-legacy + COPY . /app WORKDIR /app -# Add Node.js to the container. If you don't want to wait for this to install every -# time you rebuild your container, consider creating an image that has it preinstalled. -RUN apt-get update -RUN apt-get install -y build-essential nodejs nodejs-legacy - RUN ["dotnet", "restore"] RUN ["dotnet", "build"] diff --git a/templates/ReactSpa/Dockerfile b/templates/ReactSpa/Dockerfile index b382b9ea..748edec0 100644 --- a/templates/ReactSpa/Dockerfile +++ b/templates/ReactSpa/Dockerfile @@ -1,14 +1,12 @@ FROM microsoft/dotnet:latest +RUN apt-get update +RUN apt-get install -y build-essential nodejs nodejs-legacy + COPY . /app WORKDIR /app -# Add Node.js to the container. If you don't want to wait for this to install every -# time you rebuild your container, consider creating an image that has it preinstalled. -RUN apt-get update -RUN apt-get install -y build-essential nodejs nodejs-legacy - RUN ["dotnet", "restore"] RUN ["dotnet", "build"] From 5f742f0a7cbd8ba41a8e1c0f04c62f8541652d84 Mon Sep 17 00:00:00 2001 From: Aidan Steele Date: Thu, 4 Aug 2016 11:56:10 +1000 Subject: [PATCH 2/2] Copy only project.json before dotnet restore in Dockerfile templates --- templates/Angular2Spa/Dockerfile | 4 ++-- templates/KnockoutSpa/Dockerfile | 4 ++-- templates/ReactReduxSpa/Dockerfile | 4 ++-- templates/ReactSpa/Dockerfile | 4 ++-- templates/WebApplicationBasic/Dockerfile | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/Angular2Spa/Dockerfile b/templates/Angular2Spa/Dockerfile index 748edec0..b828f968 100644 --- a/templates/Angular2Spa/Dockerfile +++ b/templates/Angular2Spa/Dockerfile @@ -3,12 +3,12 @@ FROM microsoft/dotnet:latest RUN apt-get update RUN apt-get install -y build-essential nodejs nodejs-legacy -COPY . /app - WORKDIR /app +COPY project.json . RUN ["dotnet", "restore"] +COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp diff --git a/templates/KnockoutSpa/Dockerfile b/templates/KnockoutSpa/Dockerfile index 748edec0..b828f968 100644 --- a/templates/KnockoutSpa/Dockerfile +++ b/templates/KnockoutSpa/Dockerfile @@ -3,12 +3,12 @@ FROM microsoft/dotnet:latest RUN apt-get update RUN apt-get install -y build-essential nodejs nodejs-legacy -COPY . /app - WORKDIR /app +COPY project.json . RUN ["dotnet", "restore"] +COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp diff --git a/templates/ReactReduxSpa/Dockerfile b/templates/ReactReduxSpa/Dockerfile index 748edec0..b828f968 100644 --- a/templates/ReactReduxSpa/Dockerfile +++ b/templates/ReactReduxSpa/Dockerfile @@ -3,12 +3,12 @@ FROM microsoft/dotnet:latest RUN apt-get update RUN apt-get install -y build-essential nodejs nodejs-legacy -COPY . /app - WORKDIR /app +COPY project.json . RUN ["dotnet", "restore"] +COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp diff --git a/templates/ReactSpa/Dockerfile b/templates/ReactSpa/Dockerfile index 748edec0..b828f968 100644 --- a/templates/ReactSpa/Dockerfile +++ b/templates/ReactSpa/Dockerfile @@ -3,12 +3,12 @@ FROM microsoft/dotnet:latest RUN apt-get update RUN apt-get install -y build-essential nodejs nodejs-legacy -COPY . /app - WORKDIR /app +COPY project.json . RUN ["dotnet", "restore"] +COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp diff --git a/templates/WebApplicationBasic/Dockerfile b/templates/WebApplicationBasic/Dockerfile index 10eb41aa..134c714c 100644 --- a/templates/WebApplicationBasic/Dockerfile +++ b/templates/WebApplicationBasic/Dockerfile @@ -1,11 +1,11 @@ FROM microsoft/dotnet:latest -COPY . /app - WORKDIR /app +COPY project.json . RUN ["dotnet", "restore"] +COPY . /app RUN ["dotnet", "build"] EXPOSE 5000/tcp