# Copyright 2020 Misha Brukman
# SPDX-License-Identifier: Apache-2.0
# https://misha.brukman.net/blog/2020/04/running-decade-old-games-in-containers/
FROM ubuntu:14.04
# Add 32-bit support to a 64-bit Ubuntu or Debian system:
# https://support.gog.com/hc/en-us/articles/213039665
# Without this line, `apt-get` will not be able to find the packages below.
RUN dpkg --add-architecture i386
RUN apt-get update && \
apt-get install -y \
libasound2-data:i386 \
libasound2:i386 \
libasound2-plugins:i386 \
libc6:i386 \
libcanberra-gtk-module:i386 \
libgtk2.0-0:i386 \
libnss3:i386 \
libxml2:i386
# Create a non-root user to run games with reduced permissions.
# Note: you can set any username you want here; it doesn't matter.
ENV USER=user
ENV HOME=/home/$USER
RUN useradd -ms /bin/bash $USER
# Note: the `docker run` command in `runner.sh` expects this user to have
# UID=1000; if you change it here, update it there as well.
RUN usermod --uid 1000 "$USER"
RUN groupmod --gid 1000 "$USER"
# Drop root permissions; all commands from now on will be executed as a
# regular user, so be sure to do anything requiring root permissions prior to
# this line.
USER $USER
# Declare that we will mount two directories into this container at runtime,
# one for the source media and one for the installation folder.
VOLUME /opt/game/source
VOLUME /opt/game/install
# Saved games will be stored in a subdirectory of `$HOME`, so let's just
# mount the whole home directory.
VOLUME $HOME