-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Hello,
I have created a native aot build on the windows side and have it working using the the new api project template in .net 8 preview 6. I also managed to get a native build using visual studio code in the terminal after installing dotnet 8 preview 6 and the suggested clang install in my wsl2 distribution. My next goal was to get a linux docker container built for the application but am having trouble getting my docker file right as i am using the .net8 preview 6 linux build but it of course doesnt have the clang installed to compile the native binary. Here is my docker file its a feeble attempt to get clang installed the aspnetcore image and put it in the PATH
FROM debian:latest AS temp
# Install clang and zlib1g-dev
RUN apt-get update && \
apt-get install -y clang zlib1g-dev
FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview AS base
WORKDIR /app
EXPOSE 5500
ENV ASPNETCORE_URLS=http://+:5500
USER app
FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build
COPY --from=temp /usr/lib/x86_64-linux-gnu/libclang* /usr/lib/x86_64-linux-gnu/
COPY --from=temp /usr/include/clang* /usr/include/
COPY --from=temp /usr/lib/x86_64-linux-gnu/libz* /usr/lib/x86_64-linux-gnu/
ENV PATH="/usr/lib/llvm-7/bin:${PATH}"
ARG configuration=Release
WORKDIR /src
COPY ["MyFirstAotWebApi.csproj", "./"]
RUN dotnet restore "MyFirstAotWebApi.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "MyFirstAotWebApi.csproj" -c $configuration -o /app/build
FROM build AS publish
ARG configuration=Release
RUN dotnet publish "MyFirstAotWebApi.csproj" -c $configuration -o /app/publish /p:UseAppHost=true
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MyFirstAotWebApi.dll"]
I believe the last part is also wrong as we dont need "dotnet" to run it and I dont think a dll is being produced, what should the ENTRYPOINT be and how do i get apt-get install -y clang zlib1g-dev installed on the image for the native compile?