Add a container for Ubuntu 20.04

This commit is contained in:
Brandon Rhodes 2021-06-24 08:12:02 -04:00
parent 74142a151a
commit 7144e437ec
3 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,34 @@
FROM ubuntu:20.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 \
libxt-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

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.

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-ubuntu-14.04 . 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-ubuntu-14.04 \
"$@"