Create Dockerfile
This commit is contained in:
parent
5ae056ad64
commit
d7ccd3069f
2 changed files with 78 additions and 0 deletions
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
*
|
||||
!**.sln
|
||||
!/src/
|
||||
!/test/
|
74
Dockerfile
Normal file
74
Dockerfile
Normal file
|
@ -0,0 +1,74 @@
|
|||
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" ]
|
||||
|
Loading…
Reference in a new issue