d-lang.dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829
  1. FROM tfb/base:latest
  2. RUN apt install -yqq xdg-utils
  3. ENV DLANG=/dlang
  4. ENV DMDVER="2.078.1"
  5. ENV LDCVER="1.7.0"
  6. RUN mkdir -p $DLANG && \
  7. wget http://downloads.dlang.org/releases/2.x/$DMDVER/dmd_$DMDVER-0_amd64.deb && \
  8. dpkg-deb -x dmd_$DMDVER-0_amd64.deb $DLANG && \
  9. cd $DLANG && \
  10. wget https://github.com/ldc-developers/ldc/releases/download/v$LDCVER/ldc2-$LDCVER-linux-x86_64.tar.xz && \
  11. tar xvf ldc2-$LDCVER-linux-x86_64.tar.xz && \
  12. ln -s $DLANG/ldc2-$LDCVER-linux-x86_64/bin/ldc2 $DLANG/usr/bin/ldc2
  13. # According to this file (dmd.conf) dmd will, upon execution, look for
  14. # a dmd.conf in 1) the current working directory [bad], 2) the directory
  15. # specified by the HOME environment variable [bad], 3) the directory in
  16. # which dmd resides [less bad], and 4) the /etc directory.
  17. # We are trying to maintain as little global presence as possible, so
  18. # we need to change the DFLAGS in the dmd.conf to be correctly sandboxed
  19. # to the $DLANG folder.
  20. RUN cp $DLANG/etc/dmd.conf $DLANG/usr/bin && \
  21. sed -i "s|-I/usr/|-I${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf && \
  22. sed -i "s|-L/usr/|-L${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf
  23. ENV PATH=${DLANG}/usr/bin:${PATH}