building frontend in docker

This commit is contained in:
andy 2022-02-13 20:21:27 +00:00
parent e8ddc08937
commit 4cf5749d02
3 changed files with 17 additions and 9 deletions

View File

@ -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"]

View File

@ -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

View File

@ -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