From 0a3d1d2f4dc0a97d0f49c8b15ce42a1efe3fd73b Mon Sep 17 00:00:00 2001 From: Morgan Rockett Date: Thu, 18 Jul 2024 15:39:56 -0400 Subject: [PATCH] ci: get docker merge github workflow passing; fixes #283 Signed-off-by: Morgan Rockett --- .dockerignore | 2 ++ .github/workflows/docker-merge.yml | 4 ++++ Dockerfile | 12 +++++++++--- scripts/install-build-tools.sh | 11 ++++++++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2d71ff065..1e6b7255a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ run plots .vscode .deps +!requirements.txt # E2E test results testruns @@ -13,6 +14,7 @@ charts/ # Prevent copying scripts that are unused in docker scripts/ !scripts/test.sh +!scripts/activate-venv.sh !scripts/install-build-tools.sh !scripts/setup-dependencies.sh !scripts/test-transaction.sh diff --git a/.github/workflows/docker-merge.yml b/.github/workflows/docker-merge.yml index 8ce2bc7e9..9fc1a62b7 100644 --- a/.github/workflows/docker-merge.yml +++ b/.github/workflows/docker-merge.yml @@ -6,6 +6,10 @@ on: push: branches: - 'trunk' + # to test pass/failure before a merge + pull_request: + branches: + - 'trunk' jobs: docker-build: diff --git a/Dockerfile b/Dockerfile index 1bea01572..48cdc31c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,10 +7,16 @@ ARG BASE_IMAGE="ghcr.io/mit-dci/opencbdc-tx-base:latest" # Create Base Image FROM $IMAGE_VERSION AS base +# make shell run with bash not sh +SHELL ["/bin/bash", "-c"] + # set non-interactive shell -ENV DEBIAN_FRONTEND noninteractive -ENV CMAKE_BUILD_TYPE Release -ENV BUILD_RELEASE 1 +ENV DEBIAN_FRONTEND=noninteractive +ENV CMAKE_BUILD_TYPE=Release +ENV BUILD_RELEASE=1 + +COPY requirements.txt /opt/tx-processor/requirements.txt +COPY scripts/activate-venv.sh /opt/tx-processor/scripts/activate-venv.sh RUN mkdir -p /opt/tx-processor/scripts diff --git a/scripts/install-build-tools.sh b/scripts/install-build-tools.sh index 355ab2072..523789d99 100755 --- a/scripts/install-build-tools.sh +++ b/scripts/install-build-tools.sh @@ -51,7 +51,8 @@ create_venv_install_python() { if rm -rf -- "${ENV_LOCATION}"; then echo "Removed existing virtual environment" else - echo "Failed to remove existing virtual environment"; exit 1 + echo "Failed to remove existing virtual environment" + exit 1 fi fi # install pip for linux @@ -82,10 +83,14 @@ create_venv_install_python() { if "${PY_LOC}" -m venv "${ENV_NAME}"; then echo "Virtual environment '${ENV_NAME}' created" else - echo "Virtual environment creation failed"; exit 1 + echo "Virtual environment creation failed" + exit 1 fi # activate virtual environment - source "${ROOT}/scripts/activate-venv.sh" + if ! . "${ROOT}/scripts/activate-venv.sh"; then + echo "Failed to activate virtual environment" + exit 1 + fi # install python packages if pip install -r "${ROOT}/requirements.txt"; then echo "Success installing python packages"