Add cmake layer

This commit is contained in:
tooomm 2026-05-10 14:56:06 +02:00 committed by GitHub
parent 5735a44a9a
commit e7af05206f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ FROM ubuntu:26.04 AS build
ARG DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
@ -12,22 +13,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libmariadb-dev-compat \
libprotobuf-dev \
libqt6sql6-mysql \
qt6-websockets-dev \
protobuf-compiler \
qt6-tools-dev \
qt6-tools-dev-tools
qt6-tools-dev-tools \
qt6-websockets-dev
WORKDIR /src
COPY . .
# Configure CMake
COPY CMakeLists.txt ./
COPY cmake/ ./cmake/
RUN mkdir build && cd build && \
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 && \
make -j$(nproc) && \
make install
cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0
# Build Servatrice
COPY . .
RUN cd build && \
make -j$(nproc) && make install
# -------- Runtime Stage (clean) --------
FROM ubuntu:26.04
# Install only dependencies needed at runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
libprotobuf32t64 \
libqt6sql6-mysql \
@ -35,7 +43,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Only copy installed binaries, not source
# Copy only resulting binaries from Build Stage
COPY --from=build /usr/local /usr/local
WORKDIR /home/servatrice