From 1c8fbe2ad4f39d83e04560994852fdce3702a5a2 Mon Sep 17 00:00:00 2001 From: Andrew O'Reilly-Nugent Date: Sat, 21 May 2022 04:05:23 +1000 Subject: [PATCH] Publish separate GCBM build under flint.gcbm (#107) --- .github/workflows/base.yml | 41 +++++++++++++++++++++++++++++++++- docker/Dockerfile.gcbm | 34 ++++++++++++++++++++++++++++ local/rest_api_gcbm/Dockerfile | 2 +- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile.gcbm diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index bca9f968..fb91ca97 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -58,7 +58,7 @@ jobs: permissions: contents: read packages: write - + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -89,3 +89,42 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + + publish-gcbm-image: + name: Build FLINT + needs: publish-base-image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/moja-global/flint.gbcm + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ./docker + file: "./docker/Dockerfile.gcbm" + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/docker/Dockerfile.gcbm b/docker/Dockerfile.gcbm new file mode 100644 index 00000000..d0bfec01 --- /dev/null +++ b/docker/Dockerfile.gcbm @@ -0,0 +1,34 @@ +FROM ghcr.io/moja-global/flint.core:master + +WORKDIR $ROOTDIR/src + +# moja.canada requires libpqxx. +RUN git clone --recursive https://github.com/jtv/libpqxx.git \ + && mkdir libpqxx/build \ + && cd libpqxx/build \ + && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DSKIP_BUILD_TEST=ON \ + -FSKIP_PQXX_STATIC=ON .. \ + -DCMAKE_CXX_FLAGS=-fPIC \ + -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \ + && make --quiet -j $NUM_CPU install/strip \ + && make clean \ + && cd $ROOTDIR/src + +# moja.canada +RUN git clone -b develop https://github.com/moja-global/moja.canada \ + && mkdir -p moja.canada/Source/build \ + && cd moja.canada/Source/build \ + && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$ROOTDIR \ + -DENABLE_TESTS:BOOL=OFF \ + -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql .. \ + && make --quiet -s -j $NUM_CPU \ + && make --quiet install \ + && make clean \ + && cd $ROOTDIR/src + +RUN mkdir -p /opt/gcbm +RUN ln -t /opt/gcbm /usr/local/lib/lib* +RUN ln -t /opt/gcbm /usr/local/bin/moja.cli diff --git a/local/rest_api_gcbm/Dockerfile b/local/rest_api_gcbm/Dockerfile index 8504952d..3d531fba 100644 --- a/local/rest_api_gcbm/Dockerfile +++ b/local/rest_api_gcbm/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/moja-global/moja.canada:develop +FROM ghcr.io/moja-global/flint.gcbm:master WORKDIR /app