1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-11-25 16:42:54 +01:00

Compare commits

...

1 Commits

Author SHA1 Message Date
d2e7fcd823
Update and fix Dockerfile 2024-01-25 13:59:21 +01:00

View File

@ -1,62 +1,27 @@
# +---------------------------+ # +---------------+
# | Prepare build environment | # | Prepare build |
# +---------------------------+ # +---------------+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview AS phantom-base-builder FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0 AS phantom-builder
ARG TARGETARCH ARG TARGETARCH
ADD . /app ADD . /app
WORKDIR /app WORKDIR /app
RUN mkdir /data && chmod 777 /data RUN mkdir /data && chmod 777 /data
RUN dotnet restore --arch "$TARGETARCH"
RUN dotnet publish PhantomPanel.sln \
/p:DebugType=None \
/p:DebugSymbols=false \
--arch "$TARGETARCH" \
--configuration Release
RUN find .artifacts/publish/*/* -maxdepth 0 -execdir mv '{}' 'release' \;
# +---------------------+ # +---------------------+
# | Build Phantom Agent | # | Phantom Agent image |
# +---------------------+ # +---------------------+
FROM phantom-base-builder AS phantom-agent-builder FROM mcr.microsoft.com/dotnet/nightly/runtime:8.0 AS phantom-agent
RUN dotnet publish Agent/Phantom.Agent/Phantom.Agent.csproj \
/p:DebugType=None \
/p:DebugSymbols=false \
--no-restore \
--arch "$TARGETARCH" \
--configuration Release \
--output /app/out
# +--------------------------+
# | Build Phantom Controller |
# +--------------------------+
FROM phantom-base-builder AS phantom-controller-builder
RUN dotnet publish Controller/Phantom.Controller/Phantom.Controller.csproj \
/p:DebugType=None \
/p:DebugSymbols=false \
--no-restore \
--arch "$TARGETARCH" \
--configuration Release \
--output /app/out
# +-------------------+
# | Build Phantom Web |
# +-------------------+
FROM phantom-base-builder AS phantom-controller-builder
RUN dotnet publish Web/Phantom.Web/Phantom.Web.csproj \
/p:DebugType=None \
/p:DebugSymbols=false \
--no-restore \
--arch "$TARGETARCH" \
--configuration Release \
--output /app/out
# +------------------------------+
# | Finalize Phantom Agent image |
# +------------------------------+
FROM mcr.microsoft.com/dotnet/nightly/runtime:8.0-preview AS phantom-agent
WORKDIR /data WORKDIR /data
@ -74,30 +39,30 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
apt-get install -y \ apt-get install -y \
zstd zstd
COPY --from=phantom-agent-builder --chmod=755 /app/out /app COPY --from=phantom-builder --chmod=755 /app/.artifacts/publish/Phantom.Agent/release /app
ENTRYPOINT ["dotnet", "/app/Phantom.Agent.dll"] ENTRYPOINT ["dotnet", "/app/Phantom.Agent.dll"]
# +-----------------------------------+ # +--------------------------+
# | Finalize Phantom Controller image | # | Phantom Controller image |
# +-----------------------------------+ # +--------------------------+
FROM mcr.microsoft.com/dotnet/nightly/runtime:8.0-preview AS phantom-controller FROM mcr.microsoft.com/dotnet/nightly/runtime:8.0 AS phantom-controller
WORKDIR /data WORKDIR /data
COPY --from=phantom-controller-builder --chmod=755 /app/out /app COPY --from=phantom-builder --chmod=755 /app/.artifacts/publish/Phantom.Controller/release /app
ENTRYPOINT ["dotnet", "/app/Phantom.Controller.dll"] ENTRYPOINT ["dotnet", "/app/Phantom.Controller.dll"]
# +----------------------------+ # +-------------------+
# | Finalize Phantom Web image | # | Phantom Web image |
# +----------------------------+ # +-------------------+
FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0-preview AS phantom-web FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0 AS phantom-web
WORKDIR /data WORKDIR /data
COPY --from=phantom-web-builder --chmod=755 /app/out /app COPY --from=phantom-builder --chmod=755 /app/.artifacts/publish/Phantom.Web/release /app
ENTRYPOINT ["dotnet", "/app/Phantom.Web.dll"] ENTRYPOINT ["dotnet", "/app/Phantom.Web.dll"]