Compare commits

..

2 Commits

Author SHA1 Message Date
Ivan Avdeev c6edc9f3fe embed steam Half-Life data into the image itself
allows also adding hlsdk libs to the image
makes it easier to build, manage, and run
2026-04-08 01:17:49 -04:00
Ivan Avdeev eecca09544 add initial hermetic container build-and-test support 2026-04-07 17:51:32 -04:00
6 changed files with 185 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
render/work
imagecompare
rendertest.script
container/Half-Life
+48
View File
@@ -0,0 +1,48 @@
FROM ubuntu-hlsdk
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
USER root
# Install Vulkan SDK repos
RUN wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc \
&& wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list
# Install system dependencies and development packages
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
vulkan-sdk \
libsdl2-dev \
libfreetype-dev \
\
# FFmpeg development packages
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libavfilter-dev \
libavdevice-dev \
libswscale-dev \
libswresample-dev \
libpostproc-dev \
ffmpeg \
\
# Running render tests
weston \
libgl1-mesa-dri \
mesa-vulkan-drivers \
libvulkan1 \
imagemagick
# Remove extra cache after all the installations
RUN rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
COPY build-and-test.sh /build/
# Switch to non-root user
USER ubuntu
# Default command
WORKDIR /build
CMD ["/build/build-and-test.sh"]
+48
View File
@@ -0,0 +1,48 @@
FROM ubuntu:24.04
# This cannot reference external dirs, unfortunately
ARG HALFLIFE_STEAM_FILES=./Half-Life
# Copy HL data files
RUN mkdir -p /opt/hl && chown ubuntu:ubuntu /opt/hl
COPY --chown=ubuntu:ubuntu ${HALFLIFE_STEAM_FILES}/valve /opt/hl/valve
COPY --chown=ubuntu:ubuntu ${HALFLIFE_STEAM_FILES}/valve_hd /opt/hl/valve_hd
ENV DEBIAN_FRONTEND=noninteractive
# Install generic build dependencies
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
\
# Build essential utilities
ca-certificates \
wget \
build-essential \
pkg-config \
python3 \
git
# Build FWGS hlsdk game libs
ARG FWGS_HLSDK_REF=ae84bfc0c3598fcff605a7b3bb963abe8ec3e295
RUN mkdir -p /build && chown ubuntu:ubuntu /build
USER ubuntu
RUN cd /build && \
git version && \
# git > 2.49: git clone --depth 1 --revision ${FWGS_HLSDK_REF} https://github.com/FWGS/hlsdk-portable && \
mkdir -p hlsdk-portable && \
cd hlsdk-portable && \
git init && \
git remote add origin https://github.com/FWGS/hlsdk-portable && \
git fetch --depth 1 origin ${FWGS_HLSDK_REF} && \
git checkout FETCH_HEAD && \
./waf \
configure -8 -T release \
build \
install --destdir=/opt/hl
# Cleanup build files
RUN rm -rf /build/hlsdk-portable
# At this point there's:
# /opt/hl with
# ./valve
# {dlls, cl_dlls} with fwgs/hlsdk libs
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
set -eux
echo DESTINATION_IS_WRITABLE > /opt/hl/testfile
XDG_RUNTIME_DIR=/tmp weston \
--backend=headless \
--renderer=gl \
--width=1280 \
--height=800 \
--socket=wayland-headless &
build() {
pushd /build/xash3d-fwgs
./waf configure -T release -8 \
build \
install --destdir=/opt/hl
popd
}
rendertest() {
pushd /build/HLRTest/render
WAYLAND_DISPLAY=/tmp/wayland-headless ./rendertest.py --xash-dir /opt/hl run
popd
}
time build
time rendertest
+5
View File
@@ -0,0 +1,5 @@
# Path to https://rtxash.omgwtf.ru/Half-Life-RTX/Half-Life-PBR repo clone (readonly)
HALFLIFE_PBR_REPO_DIR=${HOME}/src/Half-Life-PBR
# Path to https://github.com/w23/xash3d-fwgs/ clone (readonly)
XASH3D_RT_REPO_DIR=${HOME}/src/xash3d-fwgs
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
set -eux
NAME=xash-builder
HLRTEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
source .env
build-image-hlsdk() {
podman build -t ubuntu-hlsdk -f Containerfile.hlsdk
}
build-image() {
podman build -t ubuntu-xash-builder -f Containerfile
}
build() {
build-image-hlsdk
build-image
}
render-test() {
OUTPUT="${HLRTEST_PATH}/render/work"
# Make sure the image ubuntu user can write to the output
chmod -R o+rw "${OUTPUT}"
podman run -it --rm \
--name ${NAME} \
--userns=keep-id:uid=1000,gid=1000 \
\
--cap-drop=ALL \
--security-opt=no-new-privileges \
--read-only \
--tmpfs /tmp \
\
-v /dev/dri/renderD128:/dev/dri/renderD128:ro \
\
-v /opt/hl \
-v ${HALFLIFE_PBR_REPO_DIR}/valve/pbr:/opt/hl/valve/pbr:ro \
\
-v ${XASH3D_RT_REPO_DIR}:/build/xash3d-fwgs:O \
\
-v ${HLRTEST_PATH}:/build/HLRTest:ro \
-v ${OUTPUT}:/build/HLRTest/render/work \
\
ubuntu-xash-builder:latest \
"$@"
}
shell() {
podman exec -it ${NAME} /bin/bash
}
time "$@"