Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
echo "Update packages: "
docker exec -it $containerName sh -c "yum -y update"

echo "Add epel repos"
docker exec -it $containerName sh -c "yum -y install epel-release"

echo "Install needed packages: "
docker exec -it $containerName sh -c "yum install -y git rpm-build redhat-rpm-config gcc-c++ make nodejs"

echo "Install nvm"
docker exec -it $containerName sh -c "curl -o- | bash"

echo "Show nvm version"
docker exec -ite NVM_DIR="/root/.nvm" $containerName sh -c "\. \$NVM_DIR/ && nvm --version"

echo "Install node v10.15.0"
docker exec -ite NVM_DIR="/root/.nvm" $containerName sh -c "\. \$NVM_DIR/ && nvm install 10.15.0"

echo "Fetch release version from Github"
docker exec -it $containerName sh -c "mkdir /openhim-core-js && curl -sL '$RELEASE_VERSION.tar.gz' | tar --strip-components=1 -zxv -C /openhim-core-js"

echo "npm install && npm install speculate && npm run build"
docker exec -ite NVM_DIR="/root/.nvm" $containerName sh -c "\. \$NVM_DIR/ && cd /openhim-core-js && npm install && npm install speculate && npm run build && npm run spec"

echo "Symlink the openhim-core folder with the rpmbuild folder"
docker exec -it $containerName sh -c "ln -s /openhim-core-js ~/rpmbuild"

# if the Release Version incluldes a dash, apply workaround for rpmbuild to not break on dashes
if [[ "${RELEASE_VERSION}" == *"-"* ]]
  echo "Release Version contains unsupported dash (-) for building rpm package. Replacing with underscore (_) temporarily"
  docker exec -it $containerName sh -c "sed -i 's/$RELEASE_VERSION/$RELEASE_VERSION_TEMP/g' ~/rpmbuild/SPECS/openhim-core.spec"

echo "Build RPM package from spec"
docker exec -ite NVM_DIR="/root/.nvm" $containerName sh -c "\. \$NVM_DIR/ && rpmbuild -bb ~/rpmbuild/SPECS/openhim-core.spec"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.