website/Dockerfile
Nick Seguin b09bafd4f6
Some checks failed
dotnet build / build (push) Failing after 9s
fix build, update tailwindcss
2024-02-25 16:10:04 -06:00

67 lines
No EOL
2.3 KiB
Docker

#syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
RUN apt-get update && apt-get install -y \
curl \
gnupg2 \
libatomic1 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# install nodejs
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
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 apt-get update && apt-get install nodejs -y --no-install-recommends && rm -rf /var/lib/apt/lists/* && apt-get clean
# update npm and install pnpm
RUN npm install -g npm && npm install -g pnpm && npm cache clean --force
# install wasm-tools workload
RUN dotnet workload install wasm-tools
WORKDIR /app
COPY --link *.sln .
COPY --link global.json ./
COPY --link nuget.config ./
COPY --link targets/*.targets ./targets/
COPY --link targets/*.props ./targets/
COPY --link Directory.Build.props .
COPY --link Directory.Build.targets .
COPY --link Directory.Packages.props .
COPY --link src/NSeguin.Dev.Web/*.csproj ./src/NSeguin.Dev.Web/
COPY --link src/NSeguin.Dev.Web/libman.json ./src/NSeguin.Dev.Web/
COPY --link src/NSeguin.Dev.Web/package.json ./src/NSeguin.Dev.Web/
COPY --link src/NSeguin.Dev.Web/pnpm-lock.yaml ./src/NSeguin.Dev.Web/
COPY --link src/NSeguin.Dev.Web/tailwind.config.ts ./src/NSeguin.Dev.Web/
COPY --link src/NSeguin.Dev.Web.Client/*.csproj ./src/NSeguin.Dev.Web.Client/
COPY --link src/NSeguin.Dev.Web.Common/*.csproj ./src/NSeguin.Dev.Web.Common/
COPY --link src/NSeguin.Dev.Web.HeroIconSourceGenerator/*.csproj ./src/NSeguin.Dev.Web.HeroIconSourceGenerator/
RUN dotnet tool restore
RUN dotnet restore --configfile nuget.config --locked-mode --force-evaluate
# Copy everything else and build
COPY --link ./ .
ENV NODE_ENV=production
ENV CI=true
ENV SkipNodeBuild=true
RUN cd src/NSeguin.Dev.Web && pnpm install --frozen-lockfile && pnpm run css:build --prefix ./src/NSeguin.Dev.Web/
RUN dotnet publish -c Release /p:RestoreLockedMode=true
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# authenticate with Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "NSeguin.Dev.Web.dll"]