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
This commit is contained in:
Ivan Avdeev
2026-04-08 01:17:49 -04:00
parent eecca09544
commit c6edc9f3fe
6 changed files with 85 additions and 37 deletions
+1
View File
@@ -1,3 +1,4 @@
render/work
imagecompare
rendertest.script
container/Half-Life
+9 -17
View File
@@ -1,15 +1,17 @@
FROM ubuntu:24.04
FROM ubuntu-hlsdk
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Set working directory
WORKDIR /build
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 \
wget \
build-essential \
vulkan-sdk \
libsdl2-dev \
libfreetype-dev \
\
@@ -24,11 +26,6 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
libpostproc-dev \
ffmpeg \
\
# Utilities
pkg-config \
python3 \
python3-pip \
\
# Running render tests
weston \
libgl1-mesa-dri \
@@ -36,16 +33,11 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
libvulkan1 \
imagemagick
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 \
&& apt update \
&& apt install --no-install-recommends --no-install-suggests -y vulkan-sdk
# Remove extra cache after all the installations
RUN rm -rf /var/lib/apt/lists/*
RUN chown -R ubuntu:ubuntu /build
# Set working directory
WORKDIR /build
COPY build-and-test.sh /build/
# Switch to non-root user
+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
+7 -5
View File
@@ -1,6 +1,7 @@
#!/bin/bash
#set -eux
set -ux
set -eux
echo DESTINATION_IS_WRITABLE > /opt/hl/testfile
XDG_RUNTIME_DIR=/tmp weston \
--backend=headless \
@@ -11,14 +12,15 @@ XDG_RUNTIME_DIR=/tmp weston \
build() {
pushd /build/xash3d-fwgs
./waf configure -T release -o /build/obj -8
./waf install --destdir=/build/out
./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 /build/out run
WAYLAND_DISPLAY=/tmp/wayland-headless ./rendertest.py --xash-dir /opt/hl run
popd
}
-4
View File
@@ -1,7 +1,3 @@
# Path to Steam Half-Life data, where ./valve and ./valve_hd dirs are located (readonly)
# Must already contain build https://github.com/FWGS/hlsdk-portable libs in `dlls` and `cl_dlls/`
STEAM_HALFLIFE_DIR=${HOME}/opt/Half-Life
# Path to https://rtxash.omgwtf.ru/Half-Life-RTX/Half-Life-PBR repo clone (readonly)
HALFLIFE_PBR_REPO_DIR=${HOME}/src/Half-Life-PBR
+20 -11
View File
@@ -7,33 +7,42 @@ HLRTEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
source .env
build-image() {
podman build -t ubuntu-xash-builder .
build-image-hlsdk() {
podman build -t ubuntu-hlsdk -f Containerfile.hlsdk
}
run() {
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 \
--user $(id -u):$(id -g) \
--userns=keep-id:uid=1000,gid=1000 \
\
--cap-drop=ALL \
--security-opt=no-new-privileges \
--read-only \
--tmpfs /tmp \
--tmpfs /build/obj \
--tmpfs /build/out \
\
-v /dev/dri/renderD128:/dev/dri/renderD128:ro \
\
-v ${STEAM_HALFLIFE_DIR}/valve:/build/out/valve:O \
-v ${STEAM_HALFLIFE_DIR}/valve_hd:/build/out/valve_hd:ro \
-v ${HALFLIFE_PBR_REPO_DIR}/valve/pbr:/build/out/valve/pbr: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 ${HLRTEST_PATH}/render/work:/build/HLRTest/render/work \
-v ${OUTPUT}:/build/HLRTest/render/work \
\
ubuntu-xash-builder:latest \
"$@"