#3 - DNS support + IPv6
This commit is contained in:
+14
-54
@@ -14,20 +14,14 @@
|
||||
|
||||
ARG UBUNTU_VERSION=22.04
|
||||
|
||||
# ── toolchain stage ──────────────────────────────────────────────────────────
|
||||
FROM ubuntu:${UBUNTU_VERSION} AS toolchain
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# jammy's Vulkan headers are 1.3.204, which predates the VkBufferUsageFlags2
|
||||
# constants the renderer uses, and its glslang predates the -gVS the shader
|
||||
# target passes. LunarG publishes current headers, loader and glslang for jammy,
|
||||
# and outranks the distro packages on version.
|
||||
ARG VULKAN_SDK_VERSION=1.4.313
|
||||
|
||||
# The apt lists are kept: conan installs the xorg and egl system packages itself
|
||||
# while resolving SDL.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
software-properties-common ca-certificates gnupg wget \
|
||||
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
|
||||
&& wget -qO /etc/apt/trusted.gpg.d/lunarg.asc \
|
||||
@@ -39,15 +33,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git make ninja-build ccache pkg-config \
|
||||
python3-pip \
|
||||
vulkan-headers libvulkan-dev glslang-tools \
|
||||
libdecor-0-dev
|
||||
libdecor-0-dev libpqxx-dev
|
||||
|
||||
# cmake comes from pip because jammy ships 3.22 and the project asks for 3.26.
|
||||
ARG CMAKE_VERSION=4.4.0
|
||||
ARG CONAN_VERSION=2.31.1
|
||||
RUN pip3 install --no-cache-dir "cmake==${CMAKE_VERSION}" "conan==${CONAN_VERSION}"
|
||||
|
||||
# Some autotools dependencies (flex, by way of SDL) run sub-configures that look
|
||||
# for an unsuffixed gcc/cc and ignore $CC, so 14 has to answer to the plain names.
|
||||
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-14 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-14 \
|
||||
@@ -59,10 +50,9 @@ ENV CXX=g++
|
||||
|
||||
COPY docker/conan/jammy /etc/conan/jammy
|
||||
|
||||
# ── dependency stage ─────────────────────────────────────────────────────────
|
||||
# Kept apart from the build so that editing sources does not rebuild SDL and
|
||||
# protobuf. The conan cache lives in the image layer rather than a cache mount,
|
||||
# so the generators in /deps can never outlive the packages they point at.
|
||||
|
||||
|
||||
# toolchain installs Conan packages
|
||||
FROM toolchain AS deps
|
||||
|
||||
COPY conanfile.txt /src/conanfile.txt
|
||||
@@ -72,19 +62,14 @@ RUN conan install /src/conanfile.txt \
|
||||
--build=missing \
|
||||
--output-folder=/deps
|
||||
|
||||
# ── build stage ──────────────────────────────────────────────────────────────
|
||||
# The build tree is a cache mount, so an edit rebuilds only what it touched.
|
||||
# That is also why glm, entt and Jolt have to travel in the build context: their
|
||||
# FetchContent SOURCE_DIRs point into external/, while the stamps that record
|
||||
# them as populated live in the cached build tree. Dropping them from the
|
||||
# context would leave the stamps pointing at empty directories.
|
||||
|
||||
|
||||
# Builds the project
|
||||
FROM deps AS builder
|
||||
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
|
||||
# tw_server is absent on purpose: it needs libpqxx >= 7.7 for pqxx::params and
|
||||
# jammy carries 6.4.
|
||||
RUN --mount=type=cache,target=/build \
|
||||
--mount=type=cache,target=/root/.ccache \
|
||||
cmake -S /src -B /build -G Ninja \
|
||||
@@ -94,15 +79,7 @@ RUN --mount=type=cache,target=/build \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
|
||||
&& cmake --build /build --target \
|
||||
tw_client \
|
||||
tw_mock_client \
|
||||
tw_chat_server_exe \
|
||||
tw_chat_mock_client \
|
||||
tw_message_protocol_tests \
|
||||
tw_metrics_tests \
|
||||
tw_network_tests \
|
||||
tw_peer_to_peer_tests \
|
||||
&& cmake --build /build \
|
||||
&& mkdir -p /out/bin /out/shaders \
|
||||
&& cp /build/modules/client/tw_client \
|
||||
/build/modules/mock_client/tw_mock_client \
|
||||
@@ -111,37 +88,20 @@ RUN --mount=type=cache,target=/build \
|
||||
/out/bin/ \
|
||||
&& cp /build/modules/client/shaders/*.spirv /out/shaders/
|
||||
|
||||
# ── unit test stage ──────────────────────────────────────────────────────────
|
||||
# Catch2 suites only. The process harnesses below need peers and a network, so
|
||||
# they run as compose services instead.
|
||||
FROM builder AS test
|
||||
|
||||
RUN --mount=type=cache,target=/build \
|
||||
ctest --test-dir /build --output-on-failure
|
||||
|
||||
# ── client export stage ──────────────────────────────────────────────────────
|
||||
# Not runnable as a container; the client needs a GPU and a display. Extract it:
|
||||
# docker build -f docker/Dockerfile --target export --output type=local,dest=dist .
|
||||
# Extracts client
|
||||
FROM scratch AS export
|
||||
|
||||
COPY --from=builder /out/bin/tw_client /tw_client
|
||||
COPY --from=builder /out/shaders/ /shaders/
|
||||
|
||||
# ── runtime stages ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
# Mock client
|
||||
FROM gcr.io/distroless/base-debian12:nonroot AS mock-client
|
||||
|
||||
COPY --from=builder /out/bin/tw_mock_client /usr/local/bin/
|
||||
ENTRYPOINT ["/usr/local/bin/tw_mock_client"]
|
||||
|
||||
|
||||
FROM gcr.io/distroless/base-debian12:nonroot AS chat-server
|
||||
|
||||
COPY --from=builder /out/bin/tw_chat_server_exe /usr/local/bin/
|
||||
EXPOSE 8101/udp
|
||||
ENTRYPOINT ["/usr/local/bin/tw_chat_server_exe"]
|
||||
|
||||
|
||||
FROM gcr.io/distroless/base-debian12:nonroot AS chat-mock-client
|
||||
|
||||
COPY --from=builder /out/bin/tw_chat_mock_client /usr/local/bin/
|
||||
ENTRYPOINT ["/usr/local/bin/tw_chat_mock_client"]
|
||||
|
||||
Reference in New Issue
Block a user