From b1e5ea68104b4366dc48ec6a6b2bd807ee8e096d Mon Sep 17 00:00:00 2001 From: fpiesche Date: Sun, 28 Aug 2022 15:01:25 +0100 Subject: [PATCH 1/2] Add Dockerfile to build Ubuntu builds in containers. Update README with documentation for Docker builds --- .dockerignore | 2 ++ Dockerfile | 16 ++++++++++++++++ README.md | 10 ++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..6a6e01c108 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..ff065d8c8a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:focal AS build + +ENV DEBIAN_FRONTEND noninteractive + +ADD . /workspace +RUN apt-get update \ + && apt-get install -y \ + build-essential git cmake \ + libsdl2-dev libopenal-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + +WORKDIR /workspace +RUN cd neo && ./cmake-eclipse-linux-profile.sh +RUN cd build && make + +FROM scratch AS export +COPY --from=build /workspace/build/RBDoom3BFG /workspace/base/maps/ / diff --git a/README.md b/README.md index 766b1fa9dc..650499e8ef 100644 --- a/README.md +++ b/README.md @@ -459,6 +459,16 @@ Recommended in this case is `cmake-vs2017-64bit-windows10.bat` --- # Compiling on Linux +## Containerised build + +If your system has Docker installed, you can create RBDOOM3BFG builds without having to install any of the dependencies on your host system. There is a `Dockerfile` in this repository that will set up the environment inside an `ubuntu` container and run the build for you. To run a build inside a Docker container, simply run the following command in the root path of this repository: + + > docker build . --output type=local,dest=./build + +This will run a build and save the resulting executables to `./build` on your host machine. + +## Local build + 1. You need the following dependencies in order to compile RBDoom3BFG with all features: On Debian or Ubuntu: From 45a7f9e3dc0053ec7f93ecb035a163f36109eaf4 Mon Sep 17 00:00:00 2001 From: fpiesche Date: Mon, 31 Oct 2022 07:57:53 +0000 Subject: [PATCH 2/2] Include Vulkan SDK and ability to select build configuration --- Dockerfile | 28 +++++++++++++++++++++++----- README.md | 5 ++++- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff065d8c8a..8aae129107 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,34 @@ -FROM ubuntu:focal AS build +FROM ubuntu:focal AS rbdoom3bfg-buildenv +ENV DEBIAN_FRONTEND=noninteractive -ENV DEBIAN_FRONTEND noninteractive +# Add the Vulkan SDK repository +RUN apt-get update \ + && apt-get install -y curl gpg\ + && curl -Lso /tmp/lunarg-signing-key-pub.asc \ + http://packages.lunarg.com/lunarg-signing-key-pub.asc \ + && apt-key add /tmp/lunarg-signing-key-pub.asc \ + && curl -Lso /etc/apt/sources.list.d/lunarg-vulkan-focal.list \ + http://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list -ADD . /workspace +# Install the general RBDoom3BFG dependencies RUN apt-get update \ && apt-get install -y \ build-essential git cmake \ - libsdl2-dev libopenal-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + libsdl2-dev libopenal-dev vulkan-sdk \ + libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + +# From the previous build environment stage, actually run the build +FROM rbdoom3bfg-buildenv AS build +ARG CONFIGSCRIPT=cmake-eclipse-linux-profile.sh +ENV CONFIGSCRIPT=${CONFIGSCRIPT} + +ADD . /workspace WORKDIR /workspace -RUN cd neo && ./cmake-eclipse-linux-profile.sh +RUN cd neo && ./${CONFIGSCRIPT} RUN cd build && make +# Copy only the finished RBDoom3BFG executable to an empty image +# for use with docker build --output FROM scratch AS export COPY --from=build /workspace/build/RBDoom3BFG /workspace/base/maps/ / diff --git a/README.md b/README.md index 650499e8ef..5c8b3e4f9f 100644 --- a/README.md +++ b/README.md @@ -465,7 +465,10 @@ If your system has Docker installed, you can create RBDOOM3BFG builds without ha > docker build . --output type=local,dest=./build -This will run a build and save the resulting executables to `./build` on your host machine. +This will run a build and save the resulting executables to `./build` on your host machine. By default, this will create a build using the `eclipse-linux-profile` configuration; to customize this you can also pass in the `CONFIGSCRIPT` build argument. For example, to create a build using the Vulkan release configuration: + + > docker build . --output type=local,dest=./build --build-arg CONFIGSCRIPT=cmake-linux-vulkan-release.sh + ## Local build