diff --git a/.dockerignore b/.dockerignore index 2d71ff065..815417d99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,6 +13,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..6b4e17abb 100644 --- a/.github/workflows/docker-merge.yml +++ b/.github/workflows/docker-merge.yml @@ -6,6 +6,9 @@ on: push: branches: - 'trunk' + pull_request: + branches: + - 'trunk' jobs: docker-build: diff --git a/Dockerfile b/Dockerfile index 1bea01572..55d5c288d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,12 +8,14 @@ ARG BASE_IMAGE="ghcr.io/mit-dci/opencbdc-tx-base:latest" FROM $IMAGE_VERSION AS base # 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 RUN mkdir -p /opt/tx-processor/scripts +COPY requirements.txt /opt/tx-processor/requirements.txt +COPY scripts/activate-venv.sh /opt/tx-processor/scripts/activate-venv.sh COPY scripts/install-build-tools.sh /opt/tx-processor/scripts/install-build-tools.sh COPY scripts/setup-dependencies.sh /opt/tx-processor/scripts/setup-dependencies.sh diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh index 3e0db2aaf..68ec4b0d0 100755 --- a/scripts/build-docker.sh +++ b/scripts/build-docker.sh @@ -1,5 +1,5 @@ +#!/usr/bin/env bash -#!/bin/bash set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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"