containers building

This commit is contained in:
andy 2022-02-13 12:40:30 +00:00
parent 9dd922efac
commit 6461e31959
3 changed files with 14 additions and 12 deletions

View File

@ -6,15 +6,14 @@ COPY Selector.Cache/*.csproj ./Selector.Cache/
COPY Selector.Event/*.csproj ./Selector.Event/ COPY Selector.Event/*.csproj ./Selector.Event/
COPY Selector.Model/*.csproj ./Selector.Model/ COPY Selector.Model/*.csproj ./Selector.Model/
COPY Selector.CLI/*.csproj ./Selector.CLI/ COPY Selector.CLI/*.csproj ./Selector.CLI/
RUN dotnet restore RUN dotnet restore ./Selector.CLI/Selector.CLI.csproj
COPY . ./ COPY . ./
RUN dotnet publish Selector.CLI/Selector.CLI.csproj -c Release RUN dotnet publish Selector.CLI/Selector.CLI.csproj -c Release -o /app --no-restore
COPY ./Selector.CLI/bin/Release/net6.0/publish/ App/
FROM mcr.microsoft.com/dotnet/runtime:6.0 FROM mcr.microsoft.com/dotnet/runtime:6.0
COPY --from=build bin/Release/net6.0/publish/ App/ WORKDIR /app
WORKDIR /App COPY --from=build /app ./
ENV DOTNET_EnableDiagnostics=0 ENV DOTNET_EnableDiagnostics=0
ENTRYPOINT ["dotnet", "Selector.CLI.dll"] ENTRYPOINT ["dotnet", "Selector.CLI.dll"]

View File

@ -6,15 +6,14 @@ COPY Selector.Cache/*.csproj ./Selector.Cache/
COPY Selector.Event/*.csproj ./Selector.Event/ COPY Selector.Event/*.csproj ./Selector.Event/
COPY Selector.Model/*.csproj ./Selector.Model/ COPY Selector.Model/*.csproj ./Selector.Model/
COPY Selector.Web/*.csproj ./Selector.Web/ COPY Selector.Web/*.csproj ./Selector.Web/
RUN dotnet restore RUN dotnet restore ./Selector.Web/Selector.Web.csproj
COPY . ./ COPY . ./
RUN dotnet publish Selector.Web/Selector.Web.csproj -c Release RUN dotnet publish Selector.Web/Selector.Web.csproj -c Release -o /app --no-restore
COPY ./Selector.Web/bin/Release/net6.0/publish/ App/
FROM mcr.microsoft.com/dotnet/aspnet:6.0 FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 80 EXPOSE 80
COPY --from=build Selector.Web/bin/Release/net6.0/publish/ App/ WORKDIR /app
WORKDIR /App COPY --from=build /app ./
ENV DOTNET_EnableDiagnostics=0 ENV DOTNET_EnableDiagnostics=0
ENTRYPOINT ["dotnet", "Selector.Web.dll"] ENTRYPOINT ["dotnet", "Selector.Web.dll"]

View File

@ -1,11 +1,15 @@
version: "3.9" # optional since v1.27.0 version: "3.9" # optional since v1.27.0
services: services:
web: web:
build: Selector.Web/ build:
context: .
dockerfile: Dockerfile.Web
ports: ports:
- "8080:80" - "8080:80"
cli: cli:
build: Selector.CLI/ build:
context: .
dockerfile: Dockerfile.CLI
redis: redis:
image: redis:alpine image: redis:alpine
database: database: