IPMeow/Dockerfile
2023-06-14 11:23:05 +02:00

73 lines
1.6 KiB
Docker

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