# syntax=docker/dockerfile:1.5
# vim:ft=dockerfile
#
# Author: oxmox
#
# To build the image:
#
#   docker build --progress plain -t doompanning:latest .
#
# To run doompanning (xhost +, so it's insecure):
#
#   xhost +
#   docker container run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix doompanning
#
# and for nyan cats:
#
#   docker container run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint /build/sdl_nyan_demo doompanning

FROM debian:stable as build

ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"

RUN sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list.d/debian.sources && \
    apt-get update && apt-get install -y --no-install-recommends \
    bash build-essential git cmake ninja-build ca-certificates \
    libsdl2-dev:amd64 doom-wad-shareware

COPY . /src/
WORKDIR /build/
RUN cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/install /src/
RUN cmake --build . --target all

ENTRYPOINT [ "/build/doompanning" ]
