From 4cf5749d0213302d298083173f2a61f1a2cf36fc Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 13 Feb 2022 20:21:27 +0000 Subject: [PATCH] building frontend in docker --- Dockerfile.Web | 14 +++++++++++--- docker-compose.build.yml | 6 +++--- docker-compose.yml | 6 +++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Dockerfile.Web b/Dockerfile.Web index 4ff94aa..e795653 100644 --- a/Dockerfile.Web +++ b/Dockerfile.Web @@ -11,16 +11,24 @@ 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 --verbosity normal +# FROM base as test +# RUN dotnet restore ./Selector.Tests/Selector.Tests.csproj +# RUN dotnet test --no-restore FROM base as publish 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/ +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"] diff --git a/docker-compose.build.yml b/docker-compose.build.yml index d877b96..71a03a2 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -10,7 +10,7 @@ services: - database - redis volumes: - - "./Selector.Web/appsettings.Production.json:/appsettings.Production.json" + - "./Selector.Web/appsettings.Production.json:/app/appsettings.Production.json" environment: DOTNET_ENVIRONMENT: Production @@ -22,7 +22,7 @@ services: - database - redis volumes: - - "./Selector.CLI/appsettings.Production.json:/appsettings.Production.json" + - "./Selector.CLI/appsettings.Production.json:/app/appsettings.Production.json" environment: DOTNET_ENVIRONMENT: Production @@ -34,4 +34,4 @@ services: image: postgres ports: - "5432:5432" - env_file: .env # set POSTGRES_PASSWORD + env_file: .env # set POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB diff --git a/docker-compose.yml b/docker-compose.yml index ed504a5..8eed245 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - database - redis volumes: - - "./Selector.Web/appsettings.Production.json:/appsettings.Production.json" + - "./Selector.Web/appsettings.Production.json:/app/appsettings.Production.json" environment: DOTNET_ENVIRONMENT: Production @@ -18,7 +18,7 @@ services: - database - redis volumes: - - "./Selector.CLI/appsettings.Production.json:/appsettings.Production.json" + - "./Selector.CLI/appsettings.Production.json:/app/appsettings.Production.json" environment: DOTNET_ENVIRONMENT: Production @@ -30,4 +30,4 @@ services: image: postgres ports: - "5432:5432" - env_file: .env # set POSTGRES_PASSWORD + env_file: .env # set POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB