From 1d6830a8616d376600def0b2197454bc16e19fce Mon Sep 17 00:00:00 2001 From: tooomm Date: Sun, 10 May 2026 14:53:59 +0200 Subject: [PATCH 1/4] Docker updates --- .dockerignore | 17 +++++++++-------- Dockerfile | 37 +++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2abeb2727..0638c4ef1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,9 @@ -.git/ -build/ -.github/ -.tx/ -cockatrice/ -doc/ -oracle/ -Dockerfile +# Add (Ignore) everything in root for minimum image +/* + +# Exclude (Allow) only folder & files required for building Servatrice +!cmake/ +!libcockatrice_*/ +!servatrice/ +!CMakeLists.txt +!LICENSE diff --git a/Dockerfile b/Dockerfile index d185b746a..8b79aab75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,43 +1,52 @@ # -------- Build Stage -------- -FROM ubuntu:24.04 AS build +FROM debian:13 AS build ARG DEBIAN_FRONTEND=noninteractive +# Install build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ cmake \ - file \ g++ \ - git \ libmariadb-dev-compat \ libprotobuf-dev \ libqt6sql6-mysql \ - qt6-websockets-dev \ + ninja-build \ protobuf-compiler \ qt6-tools-dev \ - qt6-tools-dev-tools + qt6-tools-dev-tools \ + qt6-websockets-dev \ + && rm -rf /var/lib/apt/lists/* +# Copy repo source not excluded in .dockerignore WORKDIR /src COPY . . -RUN mkdir build && cd build && \ - cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 && \ - make -j$(nproc) && \ - make install + +# Configure CMake +RUN cmake -S . -B build -G Ninja \ + -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 + +# Build and install Servatrice +RUN cmake --build build --parallel $(nproc) \ + && cmake --install build # -------- Runtime Stage (clean) -------- -FROM ubuntu:24.04 +FROM debian:13-slim +# Install runtime dependencies +# Is libprotobuf-lite32t64 enough? RUN apt-get update && apt-get install -y --no-install-recommends \ libprotobuf32t64 \ libqt6sql6-mysql \ libqt6websockets6 \ - && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# Only copy installed binaries, not source -COPY --from=build /usr/local /usr/local +# Copy only resulting binaries from Build Stage +COPY --from=build /usr/local/bin/servatrice /usr/local/bin/servatrice +# Create and run as non-root user +RUN useradd -m servatrice +USER servatrice WORKDIR /home/servatrice EXPOSE 4748 From 40f47500d97e99c09cf41c5f919aeb2aafac6f59 Mon Sep 17 00:00:00 2001 From: tooomm Date: Sat, 16 May 2026 12:19:05 +0200 Subject: [PATCH 2/4] formatting --- Dockerfile | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b79aab75..c8ab56b18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,18 @@ FROM debian:13 AS build ARG DEBIAN_FRONTEND=noninteractive # Install build dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ - cmake \ - g++ \ - libmariadb-dev-compat \ - libprotobuf-dev \ - libqt6sql6-mysql \ - ninja-build \ - protobuf-compiler \ - qt6-tools-dev \ - qt6-tools-dev-tools \ - qt6-websockets-dev \ +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + cmake \ + g++ \ + libmariadb-dev-compat \ + libprotobuf-dev \ + libqt6sql6-mysql \ + ninja-build \ + protobuf-compiler \ + qt6-tools-dev \ + qt6-tools-dev-tools \ + qt6-websockets-dev \ && rm -rf /var/lib/apt/lists/* # Copy repo source not excluded in .dockerignore @@ -23,11 +24,11 @@ COPY . . # Configure CMake RUN cmake -S . -B build -G Ninja \ - -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 + -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 # Build and install Servatrice RUN cmake --build build --parallel $(nproc) \ - && cmake --install build + && cmake --install build # -------- Runtime Stage (clean) -------- @@ -35,10 +36,11 @@ FROM debian:13-slim # Install runtime dependencies # Is libprotobuf-lite32t64 enough? -RUN apt-get update && apt-get install -y --no-install-recommends \ - libprotobuf32t64 \ - libqt6sql6-mysql \ - libqt6websockets6 \ +RUN apt-get update + && apt-get install -y --no-install-recommends \ + libprotobuf32t64 \ + libqt6sql6-mysql \ + libqt6websockets6 \ && rm -rf /var/lib/apt/lists/* # Copy only resulting binaries from Build Stage From d769278d90027e6d42adb25c84bbe41b56be246c Mon Sep 17 00:00:00 2001 From: tooomm Date: Sat, 16 May 2026 12:45:17 +0200 Subject: [PATCH 3/4] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c8ab56b18..1adff6ffe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ FROM debian:13-slim # Install runtime dependencies # Is libprotobuf-lite32t64 enough? -RUN apt-get update +RUN apt-get update \ && apt-get install -y --no-install-recommends \ libprotobuf32t64 \ libqt6sql6-mysql \ From 6db673b67ee1a931619e88fe2440915831de056e Mon Sep 17 00:00:00 2001 From: tooomm Date: Sun, 17 May 2026 11:54:20 +0200 Subject: [PATCH 4/4] use slim image for build stage, too --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1adff6ffe..6c6c701d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # -------- Build Stage -------- -FROM debian:13 AS build +FROM debian:13-slim AS build ARG DEBIAN_FRONTEND=noninteractive