Build container for dotnet Angular projects
mjibrandl/dotnetcore-angular is a docker image to build dotnet core based Angular projects.
This image is based on microsoft/dotnet:2.2-sdk and contains everything you need to build a dotnet core based Angular project:
- Node.js 8.x LTS
- NPM (latest)
- node-sass (latest)
- Angular CLI (latest)
The image will reduce your build time to a minimum since you don't have to run
npm rebuild node-sass for every build.
Consider you created a project using
dotnet new angular -o MyAngular, all you need to containerize your project is the following Dockerfile:
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mjibrandl/dotnetcore-angular:latest AS build WORKDIR /src COPY ["MyAngular.csproj", "./"] RUN dotnet restore "./MyAngular.csproj" COPY . . WORKDIR "/src" RUN dotnet build "MyAngular.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "MyAngular.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "MyAngular.dll"]