-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is not really a bug, need guidance on a proper dockerfile for .net 8 preview 6 aot build for linux #8663
Comments
@richlander I think you've been looking into this scenario, right? |
Lots of options to consider at dotnet/dotnet-docker#4742 Looks like you are doing it "the hard way". That Debian stage isn't needed. You can do all of that in the SDK stage, skipping all of that error prone copying.
|
Hello I looked at that link am I am still not understanding what my docker file should like to make this work.Thank you,Jason DurnilOn Aug 4, 2023, at 5:27 PM, Rich Lander ***@***.***> wrote:
Lots of options to consider at dotnet/dotnet-docker#4742
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hey Rich I get this when running your example
=> ERROR [build 2/8] RUN <<EOF (apt-get update...)
2.8s
------
[build 2/8] RUN <<EOF (apt-get update...):
0.676 E: Invalid operation update
0.698 Reading package lists...
0.738 Building dependency tree...
0.739 Reading state information...
0.740 E: Unable to locate package build-essential
0.740 E: Unable to locate package clang
0.740 E: Unable to locate package libz-dev
------
…On Mon, Aug 7, 2023 at 7:52 AM Jason Durnil ***@***.***> wrote:
Is this in a working state yet
FROM mcr.microsoft.com/dotnet/aot-sdk:8.0-jammy AS build
ARG TARGETARCH
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -a $TARGETARCH
# copy and publish app and libraries
COPY . .
RUN dotnet publish -a $TARGETARCH --no-restore -o /app releasesapi.csproj
RUN rm /app/*.dbg /app/*.Development.json
# final stage/image
FROM mcr.microsoft.com/dotnet/aot-deps:8.0-jammy-chiseled
WORKDIR /app
COPY --from=build /app .
USER $APP_UID
ENTRYPOINT ["./releasesapi"]
Thank you,
Jason Durnil
On Aug 5, 2023, at 4:58 PM, Rich Lander ***@***.***> wrote:
Here's an example:
https://github.com/richlander/dotnet-docker/blob/dotnet-8-samples/samples/releasesapi-aot/Dockerfile.ubuntu
—
Reply to this email directly, view it on GitHub
<#8663 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7DCFZMIDG6ZOKWJAD5P53XT2XXPANCNFSM6AAAAAA3ENRMHQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Do you have buildkit enabled? These samples require it. |
hmm no i dont, ill install it |
I actually i have docker desktop installed with wsl2 support, it says there is nothing more i need to do to enable buildkit |
I tried I am still getting
|
Figured out the issue and got my native container built!! |
Very odd. I haven't tried that Dockerfile in WSL. Which distro (and version) were you using and which Docker version? I successfully built that Dockerfile in Ubuntu 22.04. |
It’s Ubuntu 22.04 distro but it completely rejected that <<EOF
…On Mon, Aug 7, 2023 at 2:40 PM Rich Lander ***@***.***> wrote:
Very odd. I haven't tried that Dockerfile in WSL. Which distro (and
version) were you using. I successfully built that Dockerfile in Ubuntu
22.04.
—
Reply to this email directly, view it on GitHub
<#8663 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7DCF25DHKOOFHDF36O5FLXUEZDNANCNFSM6AAAAAA3ENRMHQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I wrote the file in vscode in windows with with wsl support
…On Mon, Aug 7, 2023 at 2:50 PM Jason Durnil ***@***.***> wrote:
It’s Ubuntu 22.04 distro but it completely rejected that <<EOF
On Mon, Aug 7, 2023 at 2:40 PM Rich Lander ***@***.***>
wrote:
> Very odd. I haven't tried that Dockerfile in WSL. Which distro (and
> version) were you using. I successfully built that Dockerfile in Ubuntu
> 22.04.
>
> —
> Reply to this email directly, view it on GitHub
> <#8663 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AB7DCF25DHKOOFHDF36O5FLXUEZDNANCNFSM6AAAAAA3ENRMHQ>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
But everything is running like a charm now
…On Mon, Aug 7, 2023 at 2:52 PM Jason Durnil ***@***.***> wrote:
I wrote the file in vscode in windows with with wsl support
On Mon, Aug 7, 2023 at 2:50 PM Jason Durnil ***@***.***> wrote:
> It’s Ubuntu 22.04 distro but it completely rejected that <<EOF
>
> On Mon, Aug 7, 2023 at 2:40 PM Rich Lander ***@***.***>
> wrote:
>
>> Very odd. I haven't tried that Dockerfile in WSL. Which distro (and
>> version) were you using. I successfully built that Dockerfile in Ubuntu
>> 22.04.
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <#8663 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AB7DCF25DHKOOFHDF36O5FLXUEZDNANCNFSM6AAAAAA3ENRMHQ>
>> .
>> You are receiving this because you authored the thread.Message ID:
>> ***@***.***>
>>
>
|
One last thing i wanted to mention that might be of interest when creating docker files for this is in the aot project |
We set this value to |
Yes I’ve tried it with the Microsoft.data.sqlclient package and using that
package fails in at if that is set to true.
…On Mon, Aug 7, 2023 at 4:44 PM Rich Lander ***@***.***> wrote:
We set this value to true by default in AOT project files.
—
Reply to this email directly, view it on GitHub
<#8663 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7DCF5WGFJUXCRDKEDFAR3XUFHRHANCNFSM6AAAAAA3ENRMHQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yup. You can change the default. |
This appears to be why the Dockerfile failed on your machine. |
Hello Richard I am really close to a solution but i need apt-get install libicu70 to be installed on mcr.microsoft.com/dotnet/runtime-deps:8.0-preview-jammy-chiseled. Ive noticed it is a slim build and exactly what i want but of course i cant run apt-get update or apt get install on their. In my build image I am using I just want to get the libicu70 install and whatever path env variables it might need on the chiseled image. Is there anything you could recommend. |
I tried this because the other one gave me errors from the beginning
36.18 /root/.nuget/packages/azure.core/1.25.0/lib/net5.0/Azure.Core.dll : warning IL3053: Assembly 'Azure.Core' produced AOT analysis warnings. [/source/MySecondAotWebApi.csproj] SBuild version 17.8.0-preview-23367-03+0ff2a83e9 for .NET |
figured out my issue, for some reason i had labeled the linux builds asr arm64 instead of amd064 since with this script the #TARGETARCH variable was not coming through it builds now |
Cool. The chisel pieces should all be in the chisel stage. The way Dockerfile ARGs work is unintuitive. They have to be copied through the stages. |
Is there anything pending here or can we close this issue? |
If this continues to be a problem, please raise the issues in dotnet/docker (assuming they are container related). |
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
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?
The text was updated successfully, but these errors were encountered: