Thread overview
has anyone got dmd and/or ldc working on alpine linux in docker?
Oct 12, 2019
aliak
Oct 14, 2019
Jacob Carlborg
Oct 15, 2019
Mathias Lang
Oct 15, 2019
Aliak
Oct 16, 2019
Mathias Lang
October 12, 2019
This is the closest I've found: https://hub.docker.com/r/andrewbenton/alpine-ldc/ But it doesn't seem to work?

THere's also no package for dmd/ldc/gdc to install via apk that I can find.

Has anyone done this?

Cheers,
- Ali
October 14, 2019
On 2019-10-12 16:50, aliak wrote:
> This is the closest I've found: https://hub.docker.com/r/andrewbenton/alpine-ldc/ But it doesn't seem to work?
> 
> THere's also no package for dmd/ldc/gdc to install via apk that I can find.
> 
> Has anyone done this?

LDC 1.13.0 was released with a package for Alpine [1]. But that version is quite old

https://github.com/ldc-developers/ldc/releases/download/v1.13.0/ldc2-1.13.0-alpine-linux-x86_64.tar.xz

-- 
/Jacob Carlborg
October 15, 2019
On Saturday, 12 October 2019 at 14:50:52 UTC, aliak wrote:
> This is the closest I've found: https://hub.docker.com/r/andrewbenton/alpine-ldc/ But it doesn't seem to work?
>
> THere's also no package for dmd/ldc/gdc to install via apk that I can find.
>
> Has anyone done this?
>
> Cheers,
> - Ali

Yes, our company have. I even tried to submit it as a package upstream, but haven't got ANY feedback for than 2 months now.

https://github.com/alpinelinux/aports/pull/10107

The way we did it is by using LDC 1.8.0 to bootstrap LDC 1.17.0.
We also build our own dub, because 1) we need it for building, and 2) we needed a recent version with support for coverage (this: https://github.com/dlang/dub/pull/1755 ).

If you want to give it a quick try, you can look at how we do it:
https://github.com/bpfkorea/agora/blob/adeec783bce88feee4e115b66d11d88813546ecd/Dockerfile

Note that it's currently confined to a single version of LDC, but that's a starting point.
In the future I hope that my PR gets merged and I can get rid of all my custom setup.

Additionally, Iain Buclaw, GDC maintainer, has done a wonderful job at backporting patches for Musl. Since Alpine edge is already on GCC 9.x, that would be another way (probably more appropriate for upstream) to do bootstrapping.
October 15, 2019
On Tuesday, 15 October 2019 at 05:13:15 UTC, Mathias Lang wrote:
> [..]
>
> Yes, our company have. I even tried to submit it as a package upstream, but haven't got ANY feedback for than 2 months now.
>
> https://github.com/alpinelinux/aports/pull/10107
>

Nice work! I pinged someone who I saw recently merging PRs, so hopefully we will have this properly merged.
October 15, 2019
On Tuesday, 15 October 2019 at 05:13:15 UTC, Mathias Lang wrote:
> On Saturday, 12 October 2019 at 14:50:52 UTC, aliak wrote:
>> [...]
>
> Yes, our company have. I even tried to submit it as a package upstream, but haven't got ANY feedback for than 2 months now.
>
> [...]

Cool! Thanks for that! Question - how have you found alpine support generally? As in, do you end up having to jump through extra hoops compared to say if you had used a Debian image?
October 16, 2019
On Tuesday, 15 October 2019 at 19:32:32 UTC, Aliak wrote:
> On Tuesday, 15 October 2019 at 05:13:15 UTC, Mathias Lang wrote:
>> On Saturday, 12 October 2019 at 14:50:52 UTC, aliak wrote:
>>> [...]
>>
>> Yes, our company have. I even tried to submit it as a package upstream, but haven't got ANY feedback for than 2 months now.
>>
>> [...]
>
> Cool! Thanks for that! Question - how have you found alpine support generally? As in, do you end up having to jump through extra hoops compared to say if you had used a Debian image?

Since I had to make packages to bootstrap the compiler, build dub and rdmd, it was much more pain that using the D-provided install script, sure.

The main difference is that alpine uses a different libc (Musl), and so it needed a few patches in druntime. There are still some fixes being made: at this very moment, the last PR that made it in druntime was a fix for musl, for example.

But having an image of 10 to 15 mbs is a great improvement over the few hundreds of Mb of the Ubuntu (/Debian?) image. If you use docker a lot (for deployment or integration tests), I believe it is already worth jumping through those hoops. And once the package definitions get merged, things will be much simpler.