Run Ubuntu 14.04 on Docker to compile, run XEphem

This commit is contained in:
Brandon Rhodes 2021-06-23 17:34:13 -04:00
parent 33897fa0c2
commit d116c1ce18
3 changed files with 91 additions and 0 deletions

36
container/Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM ubuntu:14.04
# Install everything XEphem needs to compile.
ENV DEBIAN_FRONTEND noninteractive
RUN apt update
RUN apt upgrade -y -y
RUN apt install -y -y apt-file
RUN apt-file update
RUN apt install -y -y \
build-essential \
groff-base \
libmotif-dev \
libxext-dev \
libxmu-dev \
libxp-dev \
libxt-dev \
x11proto-print-dev
# Remove the Linux empty /srv directory so it does not interrupt tab
# completion of /src, where we put the XEphem source tree.
RUN rmdir /srv
# Set up /root as our home directory, with a useful bash history and an
# “.xephem” symlink that shows XEphem where to find its support files.
ENV HOME /root
RUN ln -s /src/GUI/xephem/auxil /root/.xephem
RUN echo 'make -C /src/GUI/xephem && (cd /src/GUI/xephem; ./xephem)' \
> /root/.bash_history
# Start the user in the /src directory.
WORKDIR /src
CMD /bin/bash

21
container/README.md Normal file
View File

@ -0,0 +1,21 @@
# XEphem Docker container
This directory offers a `Dockerfile` plus a small shell script `run`.
Run the shell script to build and launch a Ubuntu 14.04 container with
all the libraries XEphem needs:
./container/run
Then, at the containers prompt (which looks like `root@...:/src#`),
you can build XEphem with:
make -C /src/GUI/xephem
And run it with:
/src/GUI/xephem/xephem
If you press up-arrow at the bash prompt right after the container
launches, you will find this pair of commands already in the shell
history so you can simply press Enter to run them.

34
container/run Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
set -ex
if [ ! -f /usr/bin/docker ]
then
echo 'Error: please "apt install docker.io"' >&2
exit 2
fi
# Change directory to the directory with this script and its Dockerfile.
cd "$(dirname $0)"
# Build the Docker image from the instructions in the Dockerfile.
# Name the resulting image "xephem".
docker build -t xephem . 1>&2
# Run the "xephem" image, exposing several files from the host system
# that together should let XEphem run and connect to X Windows:
#
# 1. This XEphem source tree, which gets mounted at "/src".
# 2. The collection of X11 sockets in /tmp.
# 3. Our X session's private authority file.
exec docker run -ti \
--net=host \
-e DISPLAY=$DISPLAY \
-v ${PWD}/..:/src \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ${XAUTHORITY}:/root/.Xauthority \
xephem \
"$@"