Thread overview
DLang docker images for CircleCi 2.0
Jan 03, 2018
Seb
Jan 04, 2018
aberba
Jan 06, 2018
Seb
Jan 06, 2018
Jon Degenhardt
Jan 06, 2018
Seb
January 03, 2018
tl;dr: you can now use special D docker images for CircleCi 2.0

---
version: 2
jobs:
  build:
    docker:
      - image: dlang2/dmd-circleci
---


Available tags
--------------

The default tag (`latest`) is the last stable release.

### DMD

```yaml
- image: dlang2/dmd-circleci:nightly
- image: dlang2/dmd-circleci:beta
- image: dlang2/dmd-circleci
- image: dlang2/dmd-circleci:2.078.0
```

### LDC

```yaml
- image: dlang2/ldc-circleci:beta
- image: dlang2/ldc-circleci
- image: dlang2/ldc-circleci:1.6.0
```

### GDC

```yaml
- image: dlang2/gdc-circleci
- image: dlang2/gdc-circleci:4.8.5
```

Full list:

- https://hub.docker.com/r/dlang2/dmd-circleci/tags/
- https://hub.docker.com/r/dlang2/ldc-circleci/tags/
- https://hub.docker.com/r/dlang2/gdc-circleci/tags/

This repo is fully automated and new releases get deployed automatically.
It already has DMD 2.078.0.

Repo: https://github.com/wilzbach/dlang-docker-circleci

Cheers,

Seb

PS: I'm aware of Stefan Rohe's great D Docker images [1], but this Docker image is built on top of the specialized CircleCi image (e.g. for their SSH login).

[1] https://github.com/lindt/docker-dmd
January 04, 2018
On Wednesday, 3 January 2018 at 13:12:48 UTC, Seb wrote:
> tl;dr: you can now use special D docker images for CircleCi 2.0
>
> ---
> version: 2
> jobs:
>   build:
>     docker:
>       - image: dlang2/dmd-circleci
> ---
>
> [...]

do you orchestrate your containers in deployment?
January 06, 2018
On Wednesday, 3 January 2018 at 13:12:48 UTC, Seb wrote:
> tl;dr: you can now use special D docker images for CircleCi 2.0
>
> [snip
>
> PS: I'm aware of Stefan Rohe's great D Docker images [1], but this Docker image is built on top of the specialized CircleCi image (e.g. for their SSH login).

One useful characteristic of Stefan's images is that the Dockerhub pages include the Dockerfile and github repository links. I don't know what it takes to include them. It does make it easier to see exactly what the configuration is, find the repo, and even create PRs against them. Would be useful if they can be added to the CircleCI image pages.

My interest in this case - I use Stefan's LDC image in Travis-CI builds. Building the runtime libraries with LTO/PGO requires the ldc-build-runtime tool, which in turn requires a few additional things in the docker image, like cmake or ninja. I was interested if they might have been included in the CircleCI images as well. (Doesn't appear so.)
January 06, 2018
On Saturday, 6 January 2018 at 05:02:48 UTC, Jon Degenhardt wrote:
> On Wednesday, 3 January 2018 at 13:12:48 UTC, Seb wrote:
>> tl;dr: you can now use special D docker images for CircleCi 2.0
>>
>> [snip
>>
>> PS: I'm aware of Stefan Rohe's great D Docker images [1], but this Docker image is built on top of the specialized CircleCi image (e.g. for their SSH login).
>
> One useful characteristic of Stefan's images is that the Dockerhub pages include the Dockerfile and github repository links. I don't know what it takes to include them. It does make it easier to see exactly what the configuration is, find the repo, and even create PRs against them. Would be useful if they can be added to the CircleCI image pages.

Oh, thanks for the hint! I added a link back to the repo:

https://github.com/wilzbach/dlang-docker

(FYI: the link was in my post)

> My interest in this case - I use Stefan's LDC image in Travis-CI builds. Building the runtime libraries with LTO/PGO requires the ldc-build-runtime tool, which in turn requires a few additional things in the docker image, like cmake or ninja. I was interested if they might have been included in the CircleCI images as well. (Doesn't appear so.)


Nope, it's not. Here's the list of the packages pre-installed:

https://github.com/wilzbach/dlang-docker/blob/master/circleci/dlang.docker

However, CircleCi gives you sudo rights by default and can simply add:

> sudo apt-get update && sudo apt-get install cmake

Note that the CircleCi Docker image was motivated to test PIE-hardening with DMD, but it's still WIP:

https://github.com/dlang/dmd/pull/7579
January 06, 2018
On Thursday, 4 January 2018 at 12:18:13 UTC, aberba wrote:
> On Wednesday, 3 January 2018 at 13:12:48 UTC, Seb wrote:
>> tl;dr: you can now use special D docker images for CircleCi 2.0
>>
>> ---
>> version: 2
>> jobs:
>>   build:
>>     docker:
>>       - image: dlang2/dmd-circleci
>> ---
>>
>> [...]
>
> do you orchestrate your containers in deployment?

Oh I am not sure we are talking about the same thing. This CircleCi image is intended to be used for CircleCi _only_ and there's a lot of stuff you probably don't want to have in your production container:

https://github.com/wilzbach/dlang-docker/blob/master/circleci/template.docker

However, I also added dlang2/{dmd,ldc,gdc}-ubuntu images recently. Here's an example app built with DUB:

https://github.com/wilzbach/dlang-docker/blob/master/example-app/Dockerfile

However, note that this will install the respective D compiler in your image which typically actually don't need for your application (so again it's more intended for CI usage)
Hence, for my things I use `-static` and just COPY the binary into the docker image.
Here's an example of an Open-Source application, which I maintain, that does so:

https://github.com/dlang-tour/core/blob/master/Dockerfile
https://github.com/dlang-tour/core/blob/master/dub.sdl

It's a pity that D doesn't support Musl (a light-weight alternative to glibc) yet, but that might change soon [1].
Anyhow for now you can use glibc on alpine, e.g.:

https://github.com/wilzbach/dlang-docker/blob/master/alpine/dlang.docker

[1] https://github.com/dlang/druntime/pull/1997