web container building, frontend first

This commit is contained in:
andy 2022-02-18 22:12:59 +00:00
parent a9f33d38f4
commit 8a14f2a1db
3 changed files with 11 additions and 17 deletions

View File

@ -27,6 +27,7 @@ jobs:
build-Docker: build-Docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build # for ignoring bad builds
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -11,10 +11,6 @@ RUN dotnet restore ./Selector.CLI/Selector.CLI.csproj
COPY . ./ COPY . ./
FROM base as test
RUN dotnet restore ./Selector.Tests/Selector.Tests.csproj
RUN dotnet test --no-restore --verbosity normal
FROM base as publish FROM base as publish
RUN dotnet publish Selector.CLI/Selector.CLI.csproj -c Release -o /app --no-restore RUN dotnet publish Selector.CLI/Selector.CLI.csproj -c Release -o /app --no-restore

View File

@ -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 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base
COPY *.sln . COPY *.sln .
@ -11,25 +19,14 @@ RUN dotnet restore ./Selector.Web/Selector.Web.csproj
COPY . ./ COPY . ./
# FROM base as test
# RUN dotnet restore ./Selector.Tests/Selector.Tests.csproj
# RUN dotnet test --no-restore
FROM base as publish 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 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 FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 80 EXPOSE 80
WORKDIR /app WORKDIR /app
COPY --from=publish /app ./ COPY --from=publish /app ./
COPY --from=frontend /Selector.Web/wwwroot ./Selector.Web/wwwroot/
ENV DOTNET_EnableDiagnostics=0 ENV DOTNET_EnableDiagnostics=0
ENTRYPOINT ["dotnet", "Selector.Web.dll"] ENTRYPOINT ["dotnet", "Selector.Web.dll"]