34 lines
1.5 KiB
Docker
34 lines
1.5 KiB
Docker
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS builderbase
|
|
|
|
RUN apt update && apt install -y \
|
|
curl wget git ca-certificates gnupg && \
|
|
mkdir -p /etc/apt/keyrings && \
|
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
|
NODE_MAJOR=20 && \
|
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
|
apt update && apt install nodejs -y && \
|
|
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* && \
|
|
echo -e "cache=/npmcache\nfund=false\nreplace-registry-host=never\n" > /etc/npmrc
|
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
|
|
FROM builderbase as builder
|
|
|
|
ARG VERSION=0.2.3
|
|
|
|
WORKDIR /opt/LANCommander
|
|
RUN --mount=type=bind,source=./,target=/opt/LANCommander,rw \
|
|
--mount=type=cache,id=lancomnpm,target=/npmcache \
|
|
--mount=type=cache,id=lancomnuget,target=/root/.nuget/packages \
|
|
--mount=type=bind,source=./npmrc,target=/root/.npmrc \
|
|
cd LANCommander/wwwroot/scripts && npm install && cd /opt/LANCommander && \
|
|
dotnet build "./LANCommander/LANCommander.csproj" /p:Version="${VERSION}" && \
|
|
dotnet publish "./LANCommander/LANCommander.csproj" -c Release -o /_Build --self-contained --os linux -p:PublishSingleFile=true
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim
|
|
COPY --from=builder /_Build /opt/LANCommander
|
|
WORKDIR /opt/LANCommander
|
|
|
|
EXPOSE 1337
|
|
|
|
CMD /opt/LANCommander/LANCommander
|