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