forked from pwang200/xbridge_witness
-
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.
Publish witness server docker images rm test
- Loading branch information
Showing
15 changed files
with
371 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM debian:11-slim | ||
|
||
COPY xbridge_witnessd /opt/xbwd/bin/xbridge_witnessd |
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,17 @@ | ||
name: 'Package xbwd' | ||
description: "Create packages of xchain witness server" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build packages | ||
shell: bash | ||
run: ./Builds/CMake/packaging/build_packages.sh | ||
|
||
- name: Upload packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: xbwd_packages | ||
path: packages |
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,114 @@ | ||
name: "Package xbridge_witnessd" | ||
on: | ||
push: | ||
branches: ['main', 'release', 'develop', '*-rc*', '*-b*'] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
package: | ||
name: Build packages | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rippleci/xbwd-builder | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build packages | ||
uses: ./.github/actions/package | ||
|
||
- name: Save server | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: xbwd | ||
path: build/xbridge_witnessd | ||
|
||
deploy_image: | ||
runs-on: ubuntu-latest | ||
name: Publish Docker images | ||
needs: package | ||
env: | ||
# The repo on Docker Hub the image will get pushed to. GHCR will be set by ${{ github.repository_owner }} | ||
DOCKERHUB_REPO: legleux | ||
# The the "latest" image will be built from this branch | ||
LATEST_BRANCH: main | ||
IMAGE_NAME: xbwd | ||
DH_CREDS: "${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PW }}" | ||
GH_CREDS: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: xbwd | ||
|
||
- name: Set tags | ||
id: tag_name | ||
shell: bash | ||
run: | | ||
SHA=${GITHUB_SHA::7} | ||
BASE_IMAGE_NAME=${IMAGE_NAME}:${SHA} | ||
echo "BASE_IMAGE_NAME=${BASE_IMAGE_NAME}" >> $GITHUB_OUTPUT | ||
BRANCH=${GITHUB_REF#refs/heads/} | ||
DH_TAGS="${SHA} ${BRANCH}" | ||
GH_TAGS="${SHA} ${BRANCH}" | ||
DH_IMAGE_NAME=${DOCKERHUB_REPO}/${IMAGE_NAME} | ||
echo "DH_IMAGE_NAME=${DH_IMAGE_NAME}" >> $GITHUB_OUTPUT | ||
GH_IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}" | ||
echo "GH_IMAGE_NAME=${GH_IMAGE_NAME}" >> $GITHUB_OUTPUT | ||
if [[ $BRANCH == $LATEST_BRANCH ]]; then | ||
echo "Tagging $BRANCH as 'latest'" | ||
DH_TAGS+=" latest" | ||
GH_TAGS+=" latest" | ||
fi | ||
echo "DH_TAGS=${DH_TAGS}" >> $GITHUB_OUTPUT | ||
echo "GH_TAGS=${GH_TAGS}" >> $GITHUB_OUTPUT | ||
- name: Build Docker image | ||
shell: bash | ||
run: | | ||
IMAGE=${{ steps.tag_name.outputs.BASE_IMAGE_NAME }} | ||
chmod +x xbridge_witnessd | ||
docker build . -t ${IMAGE} --file .github/actions/image/Dockerfile | ||
docker run --rm ${IMAGE} /opt/xbwd/bin/xbridge_witnessd --version | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_PW }} | ||
|
||
- name: Push to dockerhub | ||
shell: bash | ||
run: | | ||
for tag in ${{ steps.tag_name.outputs.DH_TAGS }}; do | ||
echo "Tagging ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} to ${{ steps.tag_name.outputs.DH_IMAGE_NAME }}:${tag} for Docker Hub" | ||
docker tag ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} ${{ steps.tag_name.outputs.DH_IMAGE_NAME }}:${tag} | ||
echo "Pushing ${{ steps.tag_name.outputs.DH_IMAGE_NAME}}:${tag} to Docker Hub" | ||
docker push ${{ steps.tag_name.outputs.DH_IMAGE_NAME}}:${tag} | ||
done | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push to ghcr | ||
shell: bash | ||
run: | | ||
for tag in ${{ steps.tag_name.outputs.GH_TAGS }}; do | ||
echo "Tagging ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} to ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} for GHCR" | ||
docker tag ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} | ||
echo "Pushing ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} to GHCR" | ||
docker push ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} | ||
done |
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,15 @@ | ||
#[===================================================================[ | ||
read version from source | ||
#]===================================================================] | ||
|
||
file (STRINGS src/xbwd/app/BuildInfo.cpp BUILD_INFO) | ||
foreach (line_ ${BUILD_INFO}) | ||
if (line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"") | ||
set (xbwd_version ${CMAKE_MATCH_1}) | ||
endif () | ||
endforeach () | ||
if (xbwd_version) | ||
message (STATUS "XBridgeWitness version: ${xbwd_version}") | ||
else () | ||
message (FATAL_ERROR "unable to determine XBridgeWitness version") | ||
endif () |
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,66 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
src_dir=${SCRIPT_DIR}/../../.. | ||
bin_dir="${src_dir}/build" | ||
pkg_dir="${src_dir}/packages" | ||
build_config=Release | ||
conan_packages_to_build="missing" | ||
#conan_profile="default" | ||
nproc=$(($(nproc) - 2)) | ||
|
||
if [ $nproc -lt 3 ]; then | ||
nproc=$(nproc) | ||
fi | ||
exe="xbridge_witnessd" | ||
|
||
. /etc/os-release | ||
if [ $ID = centos ]; then | ||
source /opt/rh/devtoolset-11/enable | ||
source /opt/rh/rh-python38/enable | ||
conan_packages_to_build="" # blank bc all dependencies need to be built for CentOS 7 currently | ||
#conan_profile="centos" # TODO: Make a "centos" profile and upload the bin pkgs | ||
#conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod || true | ||
fi | ||
|
||
conan profile new default --detect | ||
conan profile update settings.compiler.cppstd=20 default | ||
conan profile update settings.compiler.libcxx=libstdc++11 default | ||
|
||
conan install ${src_dir} \ | ||
--output-folder "${bin_dir}" \ | ||
--install-folder "${bin_dir}" \ | ||
--build ${conan_packages_to_build} \ | ||
--settings build_type=${build_config} | ||
|
||
cmake \ | ||
-S "${src_dir}" \ | ||
-B "${bin_dir}" \ | ||
-DCMAKE_BUILD_TYPE=${build_config} \ | ||
-DPKG=deb \ | ||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake | ||
|
||
cmake \ | ||
--build "${bin_dir}" \ | ||
--parallel $nproc \ | ||
--target ${exe} \ | ||
--target package | ||
|
||
cmake \ | ||
-S "${src_dir}" \ | ||
-B "${bin_dir}" \ | ||
-DCMAKE_BUILD_TYPE=${build_config} \ | ||
-DPKG=rpm \ | ||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake | ||
|
||
cmake \ | ||
--build "${bin_dir}" \ | ||
--parallel $nproc \ | ||
--target package | ||
|
||
if [ $build_config = "Release" ]; then | ||
strip ${bin_dir}/${exe} | ||
fi | ||
|
||
rm -rf ${pkg_dir}/_CPack_Packages |
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,23 @@ | ||
set(CPACK_GENERATOR "DEB") | ||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://github.com/seelabs/xbridge_witness") | ||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "rippled") | ||
set(CPACK_DEBIAN_PACKAGE_DEBUG ON) | ||
set(CPACK_SYSTEM_NAME "amd64") | ||
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON) | ||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CPACK_SYSTEM_NAME}) | ||
set(CPACK_DEBIAN_PACKAGE_RELEASE 1) | ||
set(RIPPLED_VERSION ${CPACK_PACKAGE_VERSION}) | ||
message("CPACK_PACKAGE_VERSION: ${CPACK_PACKAGE_VERSION}") | ||
string(REPLACE "-" ";" VERSION_LIST ${CPACK_PACKAGE_VERSION}) | ||
message("VERSION_LIST: ${VERSION_LIST}") | ||
list(GET VERSION_LIST 0 CPACK_PACKAGE_VERSION) | ||
list (LENGTH VERSION_LIST _len) | ||
|
||
if (${_len} GREATER 1) | ||
list(GET VERSION_LIST 1 PRE_VERSION) | ||
message("PRE_VERSION: ${PRE_VERSION}") | ||
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}~${PRE_VERSION}") | ||
else() | ||
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") | ||
endif() | ||
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_SYSTEM_NAME}") |
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,23 @@ | ||
include(GNUInstallDirs) | ||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) | ||
set(CPACK_PACKAGE_VENDOR "Ripple") | ||
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/xbwd") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "xchain witness") | ||
include(XBridgeWitnessVersion) | ||
set(CPACK_PACKAGE_VERSION "${xbwd_version}") | ||
set(CPACK_PACKAGE_VENDOR "Ripple") | ||
set(CPACK_PACKAGE_CONTACT "Ripple Labs Inc. <[email protected]>") | ||
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_SOURCE_DIR}/packages) | ||
|
||
if(${PKG} STREQUAL deb) | ||
include(packaging/deb) | ||
elseif(${PKG} STREQUAL rpm) | ||
include(packaging/rpm) | ||
else() | ||
message(ERROR "No package type provided!") | ||
endif() | ||
message("Building ${PKG} package.") | ||
|
||
set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_BINARY_DIR}) | ||
|
||
include(CPack) |
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,26 @@ | ||
cmake_policy(SET CMP0057 NEW) | ||
set(CPACK_GENERATOR "RPM") | ||
set(CPACK_RPM_PACKAGE_DEBUG ON) | ||
|
||
set(CPACK_SYSTEM_NAME "x86_64") | ||
set(CPACK_RPM_INSTALL_WITH_EXEC ON) | ||
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /src_dir) | ||
set(CPACK_RPM_DEBUGINFO_PACKAGE ON) | ||
set(CPACK_RPM_PACKAGE_DEBUG ON) | ||
set(CPACK_BUILD_SOURCE_DIRS ${CMAKE_SOURCE_DIR}/src/xbwd) | ||
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el7") | ||
set(RIPPLED_VERSION ${CPACK_PACKAGE_VERSION}) | ||
string(REPLACE "-" ";" VERSION_LIST ${CPACK_PACKAGE_VERSION}) | ||
list(GET VERSION_LIST 0 CPACK_RPM_PACKAGE_VERSION) | ||
|
||
message("CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}") | ||
message("VERSION_LIST ${VERSION_LIST}") | ||
list (LENGTH VERSION_LIST _len) | ||
if (${_len} GREATER 1) | ||
list(GET VERSION_LIST 1 PRE_VERSION) | ||
message("PRE_VERSION: ${PRE_VERSION}") | ||
set(CPACK_RPM_PACKAGE_RELEASE "0.1${CPACK_RPM_PACKAGE_RELEASE}.${PRE_VERSION}") | ||
else() | ||
set(CPACK_RPM_PACKAGE_RELEASE "1${CPACK_RPM_PACKAGE_RELEASE}") | ||
set(CPACK_RPM_FILE_NAME RPM-DEFAULT) | ||
endif() |
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,15 @@ | ||
FROM centos:7 as builder | ||
|
||
ARG CMAKE_VERSION=3.27.7 | ||
ARG GIT_VERSION=2.42.0 | ||
# https://github.com/docker/buildx/issues/379 | ||
RUN ulimit -n 1024000 && yum update -y | ||
|
||
COPY ./setup_centos.sh /tmp/setup_centos.sh | ||
RUN /tmp/setup_centos.sh | ||
|
||
COPY ./build_git.sh /tmp/build_git.sh | ||
RUN /tmp/build_git.sh ${GIT_VERSION} | ||
|
||
COPY ./install_cmake.sh /tmp/install_cmake.sh | ||
RUN /tmp/install_cmake.sh ${CMAKE_VERSION} |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
GIT_VERSION=${GIT_VERSION:-"2.42.0"} | ||
tar_file=${GIT_VERSION}.tar.gz | ||
curl -OJL https://github.com/git/git/archive/refs/tags/v${tar_file} | ||
tar zxvf git-${tar_file} && rm git-${tar_file} | ||
|
||
cd git-${GIT_VERSION} | ||
|
||
. /etc/os-release | ||
if [ $ID = centos ]; then | ||
source /opt/rh/devtoolset-11/enable | ||
fi | ||
|
||
make configure | ||
./configure | ||
make git -j$(nproc) | ||
make install git | ||
cd .. | ||
rm -rf git-${GIT_VERSION} | ||
git --version | cut -d ' ' -f3 |
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,14 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
CMAKE_VERSION=${CMAKE_VERSION:-"3.27.7"} | ||
|
||
IFS='.' read -ra CMAKE_VERSION_ARRAY <<< $CMAKE_VERSION | ||
read -r CMAKE_MAJ_VERSION CMAKE_MIN_VERSION CMAKE_PATCH_VERSIONc <<< ${CMAKE_VERSION_ARRAY[@]} | ||
CMAKE_SCRIPT="cmake-${CMAKE_VERSION}-linux-x86_64.sh" | ||
|
||
curl -OJL "https://cmake.org/files/v${CMAKE_MAJ_VERSION}.${CMAKE_MIN_VERSION}/${CMAKE_SCRIPT}" | ||
chmod +x "${CMAKE_SCRIPT}" | ||
|
||
./"${CMAKE_SCRIPT}" --skip-license --prefix=/usr/local | ||
rm "${CMAKE_SCRIPT}" |
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,21 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# https://github.com/docker/buildx/issues/379 | ||
ulimit -n 1024000 | ||
|
||
yum update -y | ||
yum upgrade -y | ||
yum install -y epel-release centos-release-scl | ||
yum install -y \ | ||
cmake wget \ | ||
rpm-build gnupg \ | ||
rh-python38 \ | ||
devtoolset-11 \ | ||
libstdc++-static \ | ||
automake pkgconfig gettext libcurl-devel | ||
yum clean all | ||
rm -rf /var/cache/yum | ||
|
||
source /opt/rh/rh-python38/enable | ||
pip install "conan<2" |
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
Oops, something went wrong.