IPMeow/Dockerfile

74 lines
1.6 KiB
Text
Raw Permalink Normal View History

2023-04-27 12:53:23 +02:00
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /source
COPY *.sln ./
COPY src/IPMeow.Cli/*.csproj ./src/IPMeow.Cli/
COPY src/IPMeow.Dhcp/*.csproj ./src/IPMeow.Dhcp/
COPY src/IPMeow.Lib/*.csproj ./src/IPMeow.Lib/
COPY src/IPMeow.Server/*.csproj ./src/IPMeow.Server/
COPY src/IPMeow.Viewer/*.csproj ./src/IPMeow.Viewer/
COPY test/IPMeow.Test/*.csproj test/IPMeow.Test/
RUN dotnet restore
COPY src/IPMeow.Cli/ ./src/IPMeow.Cli/
COPY src/IPMeow.Dhcp/ ./src/IPMeow.Dhcp/
COPY src/IPMeow.Lib/ ./src/IPMeow.Lib/
COPY src/IPMeow.Server/ ./src/IPMeow.Server/
COPY src/IPMeow.Viewer/ ./src/IPMeow.Viewer/
RUN dotnet build --no-restore
COPY test/IPMeow.Test/ test/IPMeow.Test/
RUN dotnet test
RUN mkdir -p /publish/{dhcp,server,viewer}
RUN dotnet publish src/IPMeow.Server -c Release --no-self-contained -o /publish/server
RUN dotnet publish src/IPMeow.Viewer -c Release --no-self-contained -o /publish/viewer
RUN dotnet publish src/IPMeow.Dhcp -c Release --no-self-contained -o /publish/dhcp
# IPMeow DHCP server
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS dhcp
WORKDIR /srv
COPY --from=build /publish/dhcp/ /srv
EXPOSE 80
EXPOSE 443
EXPOSE 67/udp
EXPOSE 547/udp
ENTRYPOINT [ "dotnet", "IPMeow.Dhcp.dll" ]
# IPMeow server
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS server
WORKDIR /srv
COPY --from=build /publish/server/ /srv
# Optional embedded DHCP server
EXPOSE 80
EXPOSE 443
EXPOSE 67/udp
EXPOSE 547/udp
ENTRYPOINT [ "dotnet", "IPMeow.Server.dll" ]
# IPMeow monitor server
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS viewer
WORKDIR /srv
COPY --from=build /publish/viewer/ /srv
EXPOSE 80
EXPOSE 443
ENTRYPOINT [ "dotnet", "IPMeow.Viewer.dll" ]