update dockerfile

This commit is contained in:
Nick Seguin 2023-12-10 20:30:49 -06:00
parent 05369455bc
commit 74f4e76115

View file

@ -2,31 +2,25 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
curl \ curl \
gnupg2 gnupg2 \
libatomic1 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# install nodejs # install nodejs
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=20 ENV NODE_MAJOR=20
RUN 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 RUN 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
RUN apt-get update && apt-get install nodejs -y RUN apt-get update && apt-get install nodejs -y --no-install-recommends && rm -rf /var/lib/apt/lists/* && apt-get clean
# update npm # update npm and install pnpm
RUN npm install -g npm RUN npm install -g npm && npm install -g pnpm && npm cache clean --force
# install pnpm
RUN npm install -g pnpm
# verify npm is installed
RUN npm --version
WORKDIR /app WORKDIR /app
# install wasm-tools workload # install wasm-tools workload
RUN dotnet workload install wasm-tools RUN dotnet workload install wasm-tools
# install missing lib
RUN apt-get install -y libatomic1
# Copy csproj and restore as distinct layers # Copy csproj and restore as distinct layers
COPY *.sln . COPY *.sln .
@ -63,6 +57,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app WORKDIR /app
COPY --from=build /app/src/NSeguin.Dev.Web/out ./ COPY --from=build /app/out ./
ENTRYPOINT ["dotnet", "NSeguin.Dev.Web.dll"] ENTRYPOINT ["dotnet", "NSeguin.Dev.Web.dll"]