Skip to content

Commit

Permalink
add docker ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Dec 8, 2024
1 parent 9692afc commit 420133d
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 19 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/cpp_full_node_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,24 @@ jobs:
export CXX='g++-10'
sudo bash -x cpp/tools/install_depends.sh -o ubuntu
mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
df -lh
echo "Disk usage before delete files: "`df -lh`
du -sch ${{ env.VCPKG_ROOT }}/buildtrees/*
du -sch ${{ env.VCPKG_ROOT }}/buildtrees/grpc/src/*
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/grpc/src
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/grpc/*-dbg
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/krb5/src
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/gsasl/src
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/protobuf/src
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/wedprcrypto/src
rm -rf ${{ env.VCPKG_ROOT }}buildtrees/openssl/src
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/openssl/*-dbg
rm -rf ${{ env.VCPKG_ROOT }}/buildtrees/*/*-dbg
df -lh
echo "Disk usage after delete files: "`df -lh`
make -j3
- name: Build for macOS
if: runner.os == 'macOS'
run: |
bash -x cpp/tools/install_depends.sh -o macos
mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
mkdir -p cpp/build && cd cpp/build && cmake -DCMAKE_PREFIX_PATH=/opt/local -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
make -j3
- name: Publish Error
if: always()
Expand Down Expand Up @@ -120,8 +123,8 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: autoconf-x64-osx-err.log
path: /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/autoconf-x64-osx-err.log
name: build-x64-osx-dbg-err.log
path: /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/build-x64-osx-dbg-err.log


build_centos:
Expand Down Expand Up @@ -179,6 +182,10 @@ jobs:
with:
toolchain: nightly-2022-07-28
override: true
- name: Prepare vcpkg
if: runner.os != 'Windows'
uses: friendlyanon/setup-vcpkg@v1
with: { committish: 51b14cd4e1230dd51c11ffeff6f7d53c61cc5297 }
- name: Check disk space
run: df . -h
- name: Free disk space
Expand All @@ -200,7 +207,7 @@ jobs:
rm -rf python
mkdir -p cpp/build
cd cpp/build
cmake3 -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DTESTS=ON ../
cmake3 -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DTESTS=ON ../
- name: FreeDiskSpace
run: |
df -lh
Expand Down Expand Up @@ -233,3 +240,9 @@ jobs:
with:
name: ppc-gateway-service-x64
path: ./cpp/build/bin/ppc-gateway-service
- name: Publish Error macos
if: always()
uses: actions/upload-artifact@v4
with:
name: vcpkg-manifest-install.log
path: /__w/WeDPR-Component/WeDPR-Component/cpp/build/vcpkg-manifest-install.log
91 changes: 91 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: WeDPR-Component docker ci
on:
push:
paths-ignore:
- "docs/**"
- "Changelog.md"
- "README.md"
tags:
- 'v3.*.*'
branches:
- main
- feature-milestone2-gateway
release:
types: [prereleased]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
RUST_BACKTRACE: 1
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get branch name
uses: nelonoel/[email protected]
- name: Fetch tag
run: |
git fetch --tags --force
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_FISCOPR_USER }}
password: ${{ secrets.DOCKER_FISCOPR_TOKEN }}
- name: Get git tag
uses: little-core-labs/[email protected]
id: tag_data
with:
tagRegex: (.*) # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
tagRegexGroup: 1 # Optional. Default is 1.
# the model image
- name: Build and Push model images
run: |
[[ ${{github.ref}} == */tags/* ]] && MODEL_DOCKER_TAG="${GIT_TAG_NAME}" || MODEL_DOCKER_TAG="${BRANCH_NAME}"
MODEL_DOCKER_TAG="fiscoorg/wedpr-model-service:${MODEL_DOCKER_TAG}"
echo "* Begin to build model docker: ${MODEL_DOCKER_TAG}"
cd docker-files/model/model
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} -t ${MODEL_DOCKER_TAG} .
echo "* Build model docker: ${MODEL_DOCKER_TAG} success"
docker push ${MODEL_DOCKER_TAG}
echo "* Push model docker: ${MODEL_DOCKER_TAG} success"
# the wedpr-gateway-service image
- name: Build and Push wedpr-gateway-service images
run: |
[[ ${{github.ref}} == */tags/* ]] && GW_DOCKER_TAG="${GIT_TAG_NAME}" || GW_DOCKER_TAG="${BRANCH_NAME}"
GW_DOCKER_TAG="fiscoorg/wedpr-gateway-service:${GW_DOCKER_TAG}"
echo "* Begin to build wedpr-gateway-service docker: ${GW_DOCKER_TAG}"
cd docker-files/cpp/
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-gateway-service -t ${GW_DOCKER_TAG} .
echo "* Build wedpr-gateway-service docker: ${GW_DOCKER_TAG} success"
docker push ${GW_DOCKER_TAG}
echo "* Push wedpr-gateway-service docker: ${GW_DOCKER_TAG} success"
# the wedpr-pro-node-service image
- name: Build and Push wedpr-pro-node-service images
run: |
[[ ${{github.ref}} == */tags/* ]] && NODE_DOCKER_TAG="${GIT_TAG_NAME}" || NODE_DOCKER_TAG="${BRANCH_NAME}"
NODE_DOCKER_TAG="fiscoorg/wedpr-pro-node-service:${NODE_DOCKER_TAG}"
echo "* Begin to build wedpr-pro-node-service docker: ${NODE_DOCKER_TAG}"
cd docker-files/cpp/
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-pro-node-service -t ${NODE_DOCKER_TAG} .
echo "* Build wedpr-pro-node-service docker: ${NODE_DOCKER_TAG} success"
docker push ${NODE_DOCKER_TAG}
echo "* Push wedpr-pro-node-service docker: ${NODE_DOCKER_TAG} success"
# the wedpr-mpc-service image
- name: Build and Push wedpr-mpc-service images
run: |
[[ ${{github.ref}} == */tags/* ]] && MPC_DOCKER_TAG="${GIT_TAG_NAME}" || MPC_DOCKER_TAG="${BRANCH_NAME}"
MPC_DOCKER_TAG="fiscoorg/wedpr-mpc-service:${MPC_DOCKER_TAG}"
echo "* Begin to build wedpr-mpc-service docker: ${MPC_DOCKER_TAG}"
cd docker-files/cpp/
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-mpc-service -t ${MPC_DOCKER_TAG} .
echo "* Build wedpr-mpc-service docker: ${MPC_DOCKER_TAG} success"
docker push ${MPC_DOCKER_TAG}
echo "* Push wedpr-mpc-service docker: ${MPC_DOCKER_TAG} success"
40 changes: 40 additions & 0 deletions .github/workflows/model_docker_image_base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Manual trigger wedpr-model-service-base-image docker image build

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'the input tag'

jobs:
manual-build-model-base-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get branch name
uses: nelonoel/[email protected]
- name: Fetch tag
run: |
git fetch --tags --force
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_FISCOPR_USER }}
password: ${{ secrets.DOCKER_FISCOPR_TOKEN }}

# the model image
- name: Build and Push wedpr-model-service-base-image images
run: |
echo "* Manual build wedpr-model-service-base-image image, docker version: ${{ github.event.inputs.tags }}"
DOCKER_TAG="fiscoorg/wedpr-model-service-base-image:${{ github.event.inputs.tags }}"
echo "* Begin to build ${DOCKER_TAG}"
cd docker-files/model/base
docker build -t ${DOCKER_TAG} .
echo "* Build ${DOCKER_TAG} success"
docker push ${DOCKER_TAG}
echo "* Push ${DOCKER_TAG} success"
40 changes: 40 additions & 0 deletions .github/workflows/vcpkg_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Manual trigger vcpkg-cache docker image build

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'the input tag'

jobs:
manual-build-vcpkg-cache-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get branch name
uses: nelonoel/[email protected]
- name: Fetch tag
run: |
git fetch --tags --force
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_FISCOPR_USER }}
password: ${{ secrets.DOCKER_FISCOPR_TOKEN }}

# the model image
- name: Build and Push wedpr-component-vcpkg-cache images
run: |
echo "* Manual build wedpr-component-vcpkg-cache image, docker version: ${{ github.event.inputs.tags }}"
DOCKER_TAG="fiscoorg/wedpr-component-vcpkg-cache:${{ github.event.inputs.tags }}"
echo "* Begin to build ${DOCKER_TAG}"
cd docker-files/cpp/vcpkg
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} -t ${DOCKER_TAG} .
echo "* Build ${DOCKER_TAG} success"
docker push ${DOCKER_TAG}
echo "* Push ${DOCKER_TAG} success"
4 changes: 2 additions & 2 deletions cpp/vcpkg-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"registries": [
{
"kind": "git",
"repository": "https://github.com/FISCO-BCOS/registry",
"baseline": "535c4fc74badd509b94e8a736452fa8a76bff944",
"repository": "https://mirror.ghproxy.com/github.com/FISCO-BCOS/registry",
"baseline": "d45a1d99c6b01713252bcb734c03f2c1ac0e44b8",
"packages": [
"openssl",
"bcos-utilities",
Expand Down
17 changes: 15 additions & 2 deletions cpp/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
{
"name": "jsoncpp",
"version": "1.9.5"
},
{
"name":"gsasl",
"version": "2.2.1-no-gssapi#0"
},
{
"name": "libxml2",
"version": "2.11.5#1"
}
],
"features": {
Expand Down Expand Up @@ -116,10 +124,15 @@
"name": "bcos-boostssl",
"version>=": "3.2.3"
},
{
"name": "libxml2",
"version>=": "2.11.5#1",
"features": ["lzma", "zlib"]
},
"tarscpp",
"tbb",
"libxml2",
"libiconv"
"libiconv",
"gsasl"
]
},
"sdk": {
Expand Down
2 changes: 1 addition & 1 deletion docker-files/cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM wedpr_component_vcpkg_cache:latest as builder
FROM fiscoorg/wedpr-component-vcpkg-cache:v3.0.0 as builder

LABEL maintainer [email protected]

Expand Down
2 changes: 1 addition & 1 deletion docker-files/cpp/vcpkg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04 as wedpr_component_vcpkg_cache
FROM ubuntu:18.04 as wedpr-component-vcpkg-cache

LABEL maintainer [email protected]

Expand Down
6 changes: 3 additions & 3 deletions docker-files/cpp/vcpkg/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
echo "* build image: wedpr_component_vcpkg_cache, branch: ${1}"
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr_component_vcpkg_cache .
echo "* build image: wedpr_component_vcpkg_cache success, branch: ${1}"
echo "* build image: wedpr-component-vcpkg-cache, branch: ${1}"
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr-component-vcpkg-cache .
echo "* build image: wedpr-component-vcpkg-cache success, branch: ${1}"
4 changes: 2 additions & 2 deletions docker-files/model/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM wedpr-image:latest as wedpr-model-service-base-image
FROM fiscoorg/wedpr-image:v3.0.0 as wedpr-model-service-base-image

LABEL maintainer [email protected]

RUN apt-get install -qy --no-install-recommends libkrb5-dev pkg-config default-libmysqlclient-dev
RUN apt-get install -qy --no-install-recommends pkg-config default-libmysqlclient-dev
RUN mkdir -p /data/home/wedpr
# copy requirements
COPY depends/requirements.txt /data/home/wedpr/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion docker-files/model/model/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM wedpr-model-service-base-image:latest as wedpr-model-service
FROM wedpr-model-service-base-image:v3.0.0 as wedpr-model-service
LABEL maintainer [email protected]

ENV LANG zh_CN.UTF-8
Expand Down

0 comments on commit 420133d

Please sign in to comment.