Skip to content

Instantly share code, notes, and snippets.

@Andersoft
Created June 2, 2022 08:32
Show Gist options
  • Save Andersoft/d3df1d432abc834fbedc39f1699ab892 to your computer and use it in GitHub Desktop.
Save Andersoft/d3df1d432abc834fbedc39f1699ab892 to your computer and use it in GitHub Desktop.
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
ENV NODE_VERSION 18.2.0
ENV NODE_DOWNLOAD_SHA 73d3f98e96e098587c2154dcaa82a6469a510e89a4881663dc4c86985acf245e
ENV NODE_DOWNLOAD_URL https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz
RUN wget "$NODE_DOWNLOAD_URL" -O nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt update \
&& apt-get install -y nodejs
COPY ["src/Surveyor.Presentation/Surveyor.Presentation.csproj", "src/Surveyor.Presentation/"]
COPY ["src/Surveyor.Application/Surveyor.Application.csproj", "src/Surveyor.Application/"]
COPY ["src/Surveyor.Domain/Surveyor.Domain.csproj", "src/Surveyor.Domain/"]
COPY ["src/Surveyor.SharedKernel/Surveyor.SharedKernel.csproj", "src/Surveyor.SharedKernel/"]
RUN dotnet restore "src/Surveyor.Presentation/Surveyor.Presentation.csproj"
COPY . .
WORKDIR "/src/src/Surveyor.Presentation"
RUN dotnet build "Surveyor.Presentation.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Surveyor.Presentation.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Surveyor.Presentation.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment