From a7bc4f8631e884e18014f2724ff7bc71f1151ca3 Mon Sep 17 00:00:00 2001
From: Tammo Jan Dijkema <T.J.Dijkema@gmail.com>
Date: Wed, 14 Feb 2018 21:52:37 +0100
Subject: [PATCH] Add Dockerfile

---
 docker/Dockerfile     | 35 +++++++++++++++++++++++++++++++++++
 docker/Dockerfile-doc | 10 ++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 docker/Dockerfile
 create mode 100644 docker/Dockerfile-doc

diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..fa15c28
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,35 @@
+# Install the base image through https://github.com/ds82/ubuntu-hardy-8.04-i386-docker
+# We use an old ubuntu because g77 is not supported in newer ubuntu's
+FROM ubuntu:8.04
+
+# Install dependencies
+RUN apt-get update && apt-get install -y build-essential git tcsh g77 wget vim libx11-dev libncursesw5-dev
+
+RUN useradd -ms /bin/tcsh newstar
+
+USER newstar
+
+# Obtain source code
+WORKDIR /home/newstar
+RUN wget --no-check-certificate -q https://github.com/tammojan/Newstar/archive/master.tar.gz
+RUN tar xf master.tar.gz && mv Newstar-master/* . && rmdir Newstar-master && rm master.tar.gz
+
+# Set required environment variables for newstar, this replaces the logic in $n_root/src/sys
+ENV n_site=docker \
+    n_install=li \
+    n_hosts=docker-newstar \
+    n_ftp=ftp.astron.nl \
+    n_root=/home/newstar \
+    n_hlp=/home/newstar/hlp
+
+# Initialize paths etc at tcsh login
+RUN echo 'source $n_root/src/sys/newstar_env.csh \nsource $n_root/src/sys/newstar_init.csh' >> /home/newstar/.cshrc
+
+# Build newstar
+WORKDIR /home/newstar/src
+RUN tcsh -c 'nup build -u wntinc'
+RUN tcsh -c 'nup build -u -t:exe wntinc'
+RUN tcsh -c 'nup build -u all'
+
+WORKDIR /home/newstar
+ENTRYPOINT tcsh
diff --git a/docker/Dockerfile-doc b/docker/Dockerfile-doc
new file mode 100644
index 0000000..b90ada8
--- /dev/null
+++ b/docker/Dockerfile-doc
@@ -0,0 +1,10 @@
+FROM newstar
+
+# The following is only necessary for generating the documentation
+USER root
+RUN apt-get update && apt-get install -y imagemagick texlive-full
+USER newstar
+# Documentation: convert xbm into png since modern webbrowsers don't understand xbm
+RUN cd $n_hlp && find . -name '*.xbm'  -exec sh -c 'convert $0 ${0%.xbm}.png' {} \;
+RUN cd $n_hlp && find . -name '*.html' -exec sed -i -e 's/\.xbm/.png/g' {} \;
+
-- 
GitLab