forked from anydistro/bxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A pretty major change including a lot of refactoring. - New versions of the folllowing tools: - Conan 2 - Ubuntu 24.04 - LLVM 18 - Clean up deprecations (e.g. removed FetchContent_Populate) - Refactor the CMake files with comments added - Bump multiple dependencies, adapt to their new API - Migrated to conanfile.py - Use CMake presets (Fixes anydistro#7)
- Loading branch information
1 parent
ae2ef17
commit 80f8493
Showing
23 changed files
with
382 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"clang-format.executable": "clang-format-17", | ||
"clangd.path": "clangd-17", | ||
"lldb-dap.executable-path": "/bin/lldb-vscode-17" | ||
"clangd.path": "clangd-18", | ||
"lldb-dap.executable-path": "/bin/lldb-dap-18" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"version": 3, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 23, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "base", | ||
"generator": "Ninja", | ||
"hidden": true, | ||
"binaryDir": "${sourceDir}/build/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "/cmake-conan/conan_provider.cmake" | ||
} | ||
}, | ||
{ | ||
"name": "debug", | ||
"inherits": "base", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
} | ||
}, | ||
{ | ||
"name": "release", | ||
"inherits": "base", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
} | ||
} | ||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "debug", | ||
"configurePreset": "debug" | ||
}, | ||
{ | ||
"name": "release", | ||
"configurePreset": "release" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,135 @@ | ||
#syntax=docker/dockerfile:1.9 | ||
################################################################################ | ||
# Base Stage: Prepare all dependencies and tools | ||
FROM ubuntu:22.04 as base | ||
|
||
RUN apt-get update --yes && apt-get install --yes ca-certificates curl gnupg \ | ||
&& echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" > /etc/apt/sources.list.d/llvm.list \ | ||
&& curl --silent --location https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ | ||
&& mkdir -p /etc/apt/keyrings \ | ||
&& curl --silent --location https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg \ | ||
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null \ | ||
&& apt-get update --yes \ | ||
&& apt-get install --yes build-essential git cmake libssl-dev pip ninja-build lldb-17 clangd-17 clang-format-17 clang-17 libc++-17-dev libc++abi-17-dev nodejs zstd unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100 && \ | ||
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100 && \ | ||
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-17 100 && \ | ||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-17 100 && \ | ||
update-alternatives --set clang /usr/bin/clang-17 && \ | ||
update-alternatives --set clang++ /usr/bin/clang++-17 && \ | ||
update-alternatives --set cc /usr/bin/clang-17 && \ | ||
update-alternatives --set c++ /usr/bin/clang++-17 | ||
|
||
RUN pip install conan==1.63.0 \ | ||
&& conan profile new default --detect \ | ||
&& conan profile update settings.compiler=clang default \ | ||
&& conan profile update settings.compiler.version=17 default \ | ||
&& conan profile update settings.compiler.libcxx=libc++ default | ||
################################################################################ | ||
FROM ubuntu:24.04 as base | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN <<EOF | ||
apt-get update --yes | ||
apt-get install --yes \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg | ||
mkdir -p /etc/apt/keyrings | ||
curl --silent --location https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm-archive-keyring.gpg | ||
curl --silent --location https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /etc/apt/keyrings/kitware-archive-keyring.gpg | ||
echo "deb [signed-by=/etc/apt/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" > /etc/apt/sources.list.d/llvm.list | ||
echo "deb [signed-by=/etc/apt/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" > /etc/apt/sources.list.d/kitware.list | ||
apt-get update --yes | ||
apt-get install --yes \ | ||
build-essential \ | ||
clang-18 \ | ||
clang-format-18 \ | ||
clangd-18 \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
gnupg \ | ||
libc++-18-dev \ | ||
libc++abi-18-dev \ | ||
libssl-dev \ | ||
lldb-18 \ | ||
ninja-build \ | ||
nodejs \ | ||
pipx \ | ||
unzip \ | ||
zstd | ||
rm -rf /var/lib/apt/lists/* | ||
EOF | ||
|
||
RUN <<EOF | ||
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 | ||
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 | ||
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-18 100 | ||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-18 100 | ||
update-alternatives --set clang /usr/bin/clang-18 | ||
update-alternatives --set clang++ /usr/bin/clang++-18 | ||
update-alternatives --set cc /usr/bin/clang-18 | ||
update-alternatives --set c++ /usr/bin/clang++-18 | ||
EOF | ||
|
||
ENV PATH="/root/.bun/bin:/root/.local/bin:${PATH}" | ||
|
||
RUN pipx install conan==2.7.0 | ||
|
||
RUN conan profile detect --force --name default && \ | ||
cat <<EOF >> /root/.conan2/profiles/default | ||
compiler=clang | ||
compiler.version=18 | ||
compiler.libcxx=libc++ | ||
compiler.cppstd=23 | ||
EOF | ||
|
||
RUN git clone https://github.com/conan-io/cmake-conan.git -b develop2 /cmake-conan | ||
|
||
RUN curl -fsSL https://bun.sh/install | bash | ||
|
||
ENV PATH="/root/.bun/bin:${PATH}" | ||
|
||
COPY conanfile.txt /conan/ | ||
COPY conanfile.py /conan/ | ||
|
||
################################################################################ | ||
# Development Stage: Set up the development environment | ||
################################################################################ | ||
FROM base as development | ||
|
||
RUN conan install /conan -pr=default -s build_type=Debug --build=missing -g txt -of /conan | ||
EXPOSE 8080 | ||
RUN conan install /conan -pr=/root/.conan2/profiles/default -s build_type=Debug --build=missing -of /conan | ||
# for main application | ||
EXPOSE 8080 | ||
# for web server | ||
EXPOSE 3000 | ||
|
||
################################################################################ | ||
# Production Build Stage: Build the application for production | ||
################################################################################ | ||
FROM base as production-build | ||
|
||
RUN conan install /conan -pr=default -s build_type=Release --build=missing -g txt -of /conan | ||
RUN pipx ensurepath && conan install /conan -pr=default -s build_type=Release --build=missing -of /conan | ||
COPY ./ /src | ||
|
||
RUN cmake -B/build -S/src -DCMAKE_BUILD_TYPE=Release -G Ninja \ | ||
&& cmake --build /build \ | ||
&& cp /src/configs/box.yml /build/bin/ \ | ||
&& cp /src/configs/config.toml /build/bin/ | ||
RUN <<EOF | ||
cmake -B/build -S/src -DCMAKE_BUILD_TYPE=Release --preset release | ||
cmake --build /build | ||
EOF | ||
|
||
################################################################################ | ||
# Production Stage: Set up the environment for running the application | ||
FROM ubuntu:22.04 as production | ||
|
||
RUN apt-get update --yes \ | ||
&& apt-get install --yes ca-certificates curl gnupg \ | ||
&& echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" > /etc/apt/sources.list.d/llvm.list \ | ||
&& curl --silent --location https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ | ||
&& apt-get update && apt-get install --yes bzip2 xz-utils zlib1g liblz4-1 zstd libc++1-17 libc++abi1-17 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
################################################################################ | ||
FROM ubuntu:24.04 as production | ||
|
||
RUN <<EOF | ||
apt-get update --yes | ||
apt-get install --yes \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg | ||
mkdir -p /etc/apt/keyrings | ||
curl --silent --location https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm-archive-keyring.gpg | ||
echo "deb [signed-by=/etc/apt/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" > /etc/apt/sources.list.d/llvm.list | ||
apt-get update --yes | ||
apt-get install --yes \ | ||
bzip2 \ | ||
libc++1-18 \ | ||
libc++abi1-18 \ | ||
liblz4-1 \ | ||
xz-utils \ | ||
zlib1g \ | ||
zstd | ||
rm -rf /var/lib/apt/lists/* | ||
EOF | ||
|
||
COPY --from=production-build /build/bin /app | ||
|
||
RUN mkdir -p /app/persistence/ && \ | ||
adduser --disabled-password --gecos '' bxt \ | ||
&& chown -R bxt:bxt /app \ | ||
&& chmod 755 /app | ||
|
||
RUN <<EOF | ||
mkdir -p /app/persistence/ | ||
adduser --disabled-password --gecos '' bxt | ||
chown -R bxt:bxt /app | ||
chmod 755 /app | ||
EOF | ||
|
||
USER bxt | ||
|
||
ENV LD_LIBRARY_PATH=/app/libs/ | ||
ENV LD_LIBRARY_PATH=/app/lib/ | ||
WORKDIR /app | ||
EXPOSE 8080 | ||
CMD ["/app/bxtd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.