blockchain/utils/docker/lthn-chain/Dockerfile
Snider 88d4357628
Some checks failed
Push Compile / Linux (push) Has been cancelled
Push Compile / Windows (push) Has been cancelled
Push Compile / MacOS (push) Has been cancelled
Push Compile / Docker (push) Has been cancelled
Push Compile / Docs (push) Has been cancelled
New API Interface (#27)
This pull request introduces a comprehensive new API interface for the blockchain, leveraging OpenAPI v3 to facilitate direct consumption of chain data by GUI and web applications. This change significantly refines the project's build infrastructure, incorporating Conan for dependency management and CMake for configuration, alongside the integration of an OpenAPI Generator to produce SDKs for multiple languages. 

### Highlights

* **New API Interface**: Introduced a new API interface using OpenAPI v3 to enable GUI/WEB development to consume chain data without needing custom server applications.
* **Build System Enhancements**: Significant updates to the build system, including Makefile, CMake, and Conan configurations, to streamline the build process and support new functionalities.
* **Multi-language SDK Generation**: Integrated OpenAPI Generator to automatically create SDKs for various programming languages, including Go, Angular, and PHP, simplifying client-side integration.
2025-10-19 19:12:37 +01:00

73 lines
No EOL
2.2 KiB
Docker

# use --target=builder to return a docker image able to compile the software, probably used with -v .:/code
FROM ubuntu:24.04 AS builder
LABEL authors="snider"
ARG BUILD_THREADS=1
ARG BUILD_TESTNET=1
ARG BUILD_STATIC=0
ARG BUILD_LOCAL=1
ENV CONAN_HOME=/root/sdk
ARG BUILD_REPO=https://github.com/letheanVPN/blockchain.git
ARG BUILD_BRANCH=dev
# CONAN: disables the generation of color escape characters.
ENV NO_COLOR=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt -y upgrade
RUN apt install -y build-essential pkgconf \
curl ca-certificates bison autotools-dev checkinstall \
g++ llvm clang lld cmake python-is-python3 \
git python3 python3-pip python3-dev xz-utils gperf
RUN pip3 install mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] --break-system-packages
WORKDIR /
# Copy the build context.
COPY . /code
VOLUME /code/build/sdk
RUN if [ "$BUILD_LOCAL" = "0" ]; then \
rm -rf /code; \
git clone --recursive --branch ${BUILD_BRANCH} ${BUILD_REPO} code; \
fi
WORKDIR /code
FROM builder AS build
ARG BUILD_THREADS=1
ARG BUILD_STATIC=0
ARG BUILD_FOLDER=build/release
ARG BUILD_TYPE=Release
ARG BUILD_TESTNET=1
RUN make build CPU_CORES=${BUILD_THREADS} TESTNET=${BUILD_TESTNET} STATIC=${BUILD_STATIC}
#RUN cmake --build ${BUILD_FOLDER} --config=${BUILD_TYPE} --parallel=${THREADS}
# minor cmd-fu; TESTNEt and MAINNET, in docker context, use MAIINNET binaries names.
# do i like removing `-testnet`, no, but i dislike working around multiple names for ever more, so...
RUN if [ "$BUILD_TESTNET" = "1" ]; then \
cd ${BUILD_FOLDER}/src && \
for f in lethean-testnet-*; do \
ln -s "$f" "$(echo "$f" | sed 's/-testnet//')"; \
done; \
fi
# use --target=build-artifacts to return the binaries
FROM scratch AS build-artifacts
COPY --from=build /code/build/release/src/lethean-* /
# use --target=chain-service to return a working chain node
FROM ubuntu:24.04 AS chain-service
COPY --from=build-artifacts --chmod=+x / /bin
EXPOSE 36941
EXPOSE 36942
RUN lethean-chain-node --help
ENTRYPOINT ["lethean-chain-node", "--data-dir", "/data", "--disable-upnp", "--disable-debug-p2p-requests"]