Skip to content

andrewbenton/alpine-ldc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Alpine-LDC

A compilation for D code using LDC running on Alpine Linux. Perfect for multi-stage docker builds or playing with light environments. Dub is also included in this container.

Building

This is a pretty regular docker build. The appropriate LDC version and the latest version of Dub that the dub-registry knows about will be pulled down during the container build process. You can also pull my latest image from docker hub with docker pull andrewbenton/alpine-ldc:latest.

Optionally, a build argument can be supplied to set the version of LDC to pull. The default is v1.9.0.

Example:

export LDC_VERSION=1.9.0
docker build --build-arg "LDC_VERSION=${LDC_VERSION}" -t "alpine-ldc:${LDC_VERSION}" .

# or

make LDC=1.9.0

Running

Once the docker container is built or pulled, running it is easy.

$ docker run -it --rm alpine-ldc:1.9.0
/ # cd /tmp
/tmp # echo 'void main() { import std.stdio; writeln("hello, world!"); } ' > test.d
/tmp # ldc2 test.d -of test
/tmp # /tmp/test
hello, world!
/tmp # exit

Example

Examples require that you have docker installed on your machine. This is the simplest example.

Known issues

  • For whatever reason, the interactive dub init prompt doesn't quite work.
  • The libc version used is musl, which isn't as well supported in druntime as glibc.

About

An Alpine Linux build with LDC and Dub for Dlang

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published