Add dockerfiles for Linux environments with documentation (#1764)

* Add dockerfiles for linux environments with documentation

* Clean up documentation
pull/1766/head v0.1.23
Liam Hackett 2022-08-16 00:08:51 +01:00 committed by GitHub
parent 34d6e8d71e
commit 18dfb6c1d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 97 additions and 0 deletions

View File

@ -17,6 +17,7 @@
- [Current Status](#current-status)
- [Methodology](#methodology)
- [Setting up a Development Environment](#setting-up-a-development-environment)
- [Docker](#docker)
- [Linux](#linux)
- [Ubuntu (20.04)](#ubuntu-2004)
- [Arch](#arch)
@ -95,6 +96,30 @@ The remainder of this README is catered towards people interested in building th
If this does not sound like you and you just want to play the game, refer to the above section [How to play the game](#how-to-play-the-game)
### Docker
All three Linux systems are supported using Docker.
Pick your supported prefered flavour of linux and build your chosen image
```
docker build -f docker/(Arch|Fedora|Ubuntu)/Dockerfile -t jak .
```
This will create an image with all required dependencies and already built.
```
docker run -v "$(pwd)"/build:/home/jak/jak-project/build -it jak bash
```
Note: If you the build directory you'll need to rerun the build command. Alteratively you can get the build via `docker cp`
This will link your build folder to the images so can validate your build or test it on an external device.
Docker images can be linked into your IDE (e.g. CLion) to help with codesniffing, static analysis, run tests and continuous build.
Unfortently you'll still need task runner on your local machine to run the game or instead, manually run the game via the commands found in `Taskfile.yml`
### Linux
#### Ubuntu (20.04)

28
docker/Arch/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM archlinux:latest
RUN pacman -Syyu --noconfirm --needed cmake libpulse base-devel nasm python git libx11 libxrandr libxinerama libxcursor libxi
# makepkg user and workdir
ARG user=jak
RUN useradd --system --create-home $user \
&& echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user
USER $user
WORKDIR /home/$user
# Install yay
RUN git clone https://aur.archlinux.org/yay.git \
&& cd yay \
&& makepkg -sri --needed --noconfirm \
&& cd \
# Clean up
&& rm -rf .cache yay
RUN yay --noconfirm -S go-task
RUN mkdir /home/$user/jak-project/
COPY --chown=jak:jak . /home/$user/jak-project
RUN git config --global --add safe.directory /home/jak/jak-project
WORKDIR /home/$user/jak-project
RUN cmake -B build && cmake --build build -j 8

20
docker/Fedora/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM fedora:latest
RUN dnf install -y curl cmake python lld clang nasm libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel pulseaudio-libs-devel
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
ARG user=jak
RUN useradd -m -d /home/${user} ${user}
USER $user
WORKDIR /home/$user
RUN mkdir /home/$user/jak-project/
COPY --chown=jak:jak . /home/$user/jak-project
WORKDIR /home/$user/jak-project
RUN cmake -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build
RUN cmake --build build -j$(nproc)

24
docker/Ubuntu/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y gcc make cmake build-essential g++ nasm clang-format libxrandr-dev libxinerama-dev libxcursor-dev libpulse-dev libxi-dev python lld clang curl
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
ARG user=jak
RUN useradd -m -d /home/${user} ${user}
USER $user
WORKDIR /home/$user
RUN mkdir /home/$user/jak-project/
COPY --chown=jak:jak . /home/$user/jak-project
WORKDIR /home/$user/jak-project/build
RUN cmake -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
WORKDIR /home/$user/jak-project
RUN cmake -B build && cmake --build build -j 8