Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Last active December 15, 2022 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/7762f388b8dad04be48128e2f93d0e7a to your computer and use it in GitHub Desktop.
Save gistlyn/7762f388b8dad04be48128e2f93d0e7a to your computer and use it in GitHub Desktop.
dotnet-build-node
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& echo "node version: $(node --version)" \
&& echo "npm version: $(npm --version)" \
&& rm -rf /var/lib/apt/lists/*
COPY MyApp/package.json .
COPY MyApp/npm-shrinkwrap.json .
RUN npm --prefix MyApp install
COPY . .
RUN dotnet restore
WORKDIR /app/MyApp
RUN dotnet publish -c release -o /out --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /out ./
ENTRYPOINT ["dotnet", "MyApp.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment