Added support for 'Current' channel Dotnet Core in Dockerfile, using …#230
Added support for 'Current' channel Dotnet Core in Dockerfile, using …#230bcomnes merged 1 commit intonetlify:xenialfrom
Conversation
…local install for buildbot. Apt-get prerequisite libs added, env vars set. Package cache is pre-populated to speed-up first run of real apps
|
We could probably do this. @rybit Thoughts? |
|
I think this would be great. I was considering using an intermediate pipeline so my builds would not have to know how to install dotnet (not to mention the extra wait time). This would greatly simplify things for anyone using dotnet core. |
|
I'll include this in the xenial image which is coming out soon. |
|
@bcomnes fyi, I did a naive build using a dotnet tool. The site is created with Wyam, but the error returned seems like a missing library. From the error, it doesn't seem like it's a normal error for dotnet core. Based on the commit for v3.0.2, it seems that this change is in that version already: In full context: |
|
Im completely unfamiliar with dotnet core. @Vladekk @jhgoodwin any ideas on how to address? |
|
@bcomnes Interesting. $ docker run --rm -it netlify/build:xenial bash
... lots of downloaded layers ...
Digest: sha256:cba778d5dc6b80d3276b216cdbbb42007cf0eb06993ea4234bea8245416daca1
Status: Downloaded newer image for netlify/build:xenial
$ cd /tmp
$ git clone https://github.com/jhgoodwin/site-johngoodwin.com.git
Cloning into 'site-johngoodwin.com'...
Username for 'https://github.com': jhgoodwin
Password for 'https://jhgoodwin@github.com':
remote: Enumerating objects: 138, done.
remote: Counting objects: 100% (138/138), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 138 (delta 8), reused 138 (delta 8), pack-reused 0
Receiving objects: 100% (138/138), 3.39 MiB | 2.88 MiB/s, done.
Resolving deltas: 100% (8/8), done.
$ cd site-johngoodwin.com/
$ dotnet tool install -g Wyam.Tool
You can invoke the tool using the following command: wyam
Tool 'wyam.tool' (version '2.2.4') was successfully installed.
$ wyam build
... no error about libhostfxr.so ...Any thoughts on why I can't repro locally using these steps? Side note, I noticed there's a bunch of extra stuff on this image. It's about 2GB, and just the /tmp folder had about 445MB of data in it. |
|
Oh good catch, I bet we can clean that up. And we can't reproduce locally, Hrmm..... not ringing any bells for me. I wonder if its a permissions issue. Where does -g install to? |
|
One idea I just had: You can run the exact image we use in production by using the squash tag.
|
|
From inside the container: $ which wyam
/opt/buildhome/.dotnet/tools/wyam |
|
@bcomnes , So far, I put this into the build step, but it does not do the same thing as local: cd /tmp && git clone https://github.com/jhgoodwin/wyam-blog-template && cd wyam-blog-template && dotnet tool install -g Wyam.Tool && wyam buildFor repro inside docker, locally, I'm doing this: docker run --rm -it netlify/build:v3.0.2-squash bash -c "cd /tmp && git clone https://github.com/jhgoodwin/wyam-blog-template && cd wyam-blog-template && dotnet tool install -g Wyam.Tool && wyam build"It does not perform the same steps. The repo I pasted in the command is public, so needs no auth to read it. Any help on why they don't output the same result would be greatly appreciated. |
|
I think I found the problem! If I add this line to the beginning of my build: export DOTNET_ROOT=/opt/buildhome/.dotnet And it gets past this error! I find this interesting, because you have this in your Dockerfile near line 451: ENV DOTNET_ROOT "/opt/buildhome/.dotnet"It was mentioned in this issue https://github.com/dotnet/cli/issues/9114 so, that gave me some interest to check the exports for this environment variable. I haven't done any testing to see if there's a better way to fix this right in the Dockerfile definition, but it's a good start. |
|
This looks merged into the xenial branch. Does this mean you can use .NET Core if using Ubuntu Xenial as your build image? |
|
@mattferderer I can confirm builds can use dotnet core on the Xenial build image. I am using the following build script to build a wyam static site. https://gist.github.com/MysterDru/c4d1fd5a905c92d0d89d6936b2d7a725 |
…local install for buildbot.
Apt-get prerequisite libs added, env vars set.
Package cache is pre-populated to speed-up first run of real apps