From 8a14f2a1dba5b15f2f9ff0dba4638b1d6aa6f45c Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 18 Feb 2022 22:12:59 +0000 Subject: [PATCH] web container building, frontend first --- .github/workflows/ci.yml | 1 + Dockerfile.CLI | 4 ---- Dockerfile.Web | 23 ++++++++++------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0de289f..62d87ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: build-Docker: runs-on: ubuntu-latest + needs: build # for ignoring bad builds steps: - uses: actions/checkout@v2 diff --git a/Dockerfile.CLI b/Dockerfile.CLI index c84e036..4dcc9ad 100644 --- a/Dockerfile.CLI +++ b/Dockerfile.CLI @@ -11,10 +11,6 @@ RUN dotnet restore ./Selector.CLI/Selector.CLI.csproj COPY . ./ -FROM base as test -RUN dotnet restore ./Selector.Tests/Selector.Tests.csproj -RUN dotnet test --no-restore --verbosity normal - FROM base as publish RUN dotnet publish Selector.CLI/Selector.CLI.csproj -c Release -o /app --no-restore diff --git a/Dockerfile.Web b/Dockerfile.Web index 44975ff..d5ef40e 100644 --- a/Dockerfile.Web +++ b/Dockerfile.Web @@ -1,3 +1,11 @@ +FROM node as frontend +COPY ./Selector.Web/package.json /Selector.Web/ +COPY ./Selector.Web/package-lock.json /Selector.Web/ +WORKDIR /Selector.Web +RUN npm ci +COPY ./Selector.Web ./ +RUN npm run build + FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base COPY *.sln . @@ -11,25 +19,14 @@ RUN dotnet restore ./Selector.Web/Selector.Web.csproj COPY . ./ -# FROM base as test -# RUN dotnet restore ./Selector.Tests/Selector.Tests.csproj -# RUN dotnet test --no-restore - FROM base as publish +COPY --from=frontend /Selector.Web/wwwroot Selector.Web/wwwroot/ +COPY --from=frontend /Selector.Web/wwwroot Selector.Web/wwwroot/ RUN dotnet publish Selector.Web/Selector.Web.csproj -c Release -o /app --no-restore -FROM node as frontend -COPY ./Selector.Web/package.json /Selector.Web/ -COPY ./Selector.Web/package-lock.json /Selector.Web/ -WORKDIR /Selector.Web -RUN npm ci -COPY ./Selector.Web/ . -RUN npm run build - FROM mcr.microsoft.com/dotnet/aspnet:6.0 EXPOSE 80 WORKDIR /app COPY --from=publish /app ./ -COPY --from=frontend /Selector.Web/wwwroot ./Selector.Web/wwwroot/ ENV DOTNET_EnableDiagnostics=0 ENTRYPOINT ["dotnet", "Selector.Web.dll"]