Thread overview
has anyone got dmd and/or ldc working on alpine linux in docker?
Oct 12
aliak
5 days ago
Jacob Carlborg
4 days ago
Mathias Lang
4 days ago
Aliak
3 days ago
Mathias Lang
October 12
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
5 days ago
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
4 days ago
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.
4 days ago
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.
4 days ago
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?
3 days ago
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.