Skip to content

Commit

Permalink
Merge pull request #807 from oceanprotocol/feat/fix_dockers
Browse files Browse the repository at this point in the history
fix docker
  • Loading branch information
alexcos20 authored Sep 5, 2023
2 parents 85a1303 + f392e5a commit d288e3f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = v1.1.14
current_version = v1.1.15
commit = True
tag = True

Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,45 @@ jobs:
coverageLocations: |
${{ github.workspace }}/coverage/lcov.info:lcov
dockerbuild:
dockertest:
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: docker build -t "testimage:latest" .
run: docker build -t "oceanprotocol/ocean-contracts:test" .
- name: Set ADDRESS_FILE
run: echo "ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json" >> $GITHUB_ENV
- name: Checkout Barge
uses: actions/checkout@v3
with:
repository: 'oceanprotocol/barge'
path: 'barge'

- name: Run Ganache with Barge
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --no-ipfs --no-aquarius --no-elasticsearch --no-provider --no-dashboard 2>&1 > start_ocean.log &
env:
CONTRACTS_VERSION: test
- name: Wait for contracts deployment
working-directory: ${{ github.workspace }}/barge
run: |
for i in $(seq 1 250); do
sleep 5
[ -f "$HOME/.ocean/ocean-contracts/artifacts/ready" ] && break
done
ls -la "$HOME/.ocean/ocean-contracts/artifacts/"
- name: "Read address.json contents"
working-directory: ${{ github.workspace }}
run: cat $ADDRESS_FILE
- run: grep -q development $ADDRESS_FILE
name: Searching for development key in addresses.json
- name: docker logs
run: docker logs ocean_ocean-contracts_1
if: ${{ failure() }}

publish-npm:
needs: [lint, tests_full]
if: startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -205,4 +235,3 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@

FROM ubuntu:20.04 as base
RUN apt-get update && apt-get -y install bash curl
RUN curl -sL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
RUN bash /tmp/nodesource_setup.sh
RUN apt install nodejs
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install curl git bash ca-certificates gnupg
# nvm env vars
RUN mkdir -p /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
# IMPORTANT: set the exact version
ENV NODE_VERSION v16.20.2
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"
# add node and npm to the PATH
ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/bin
ENV PATH $NODE_PATH:$PATH



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanprotocol/contracts",
"version": "v1.1.14",
"version": "v1.1.15",
"description": "Ocean Protocol Smartcontracts",
"bugs": {
"url": "https://github.com/oceanprotocol/contracts/issues"
Expand Down
14 changes: 8 additions & 6 deletions scripts/deploy_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ echo "deploy contracts is ${DEPLOY_CONTRACTS}"

if [ "${DEPLOY_CONTRACTS}" = "true" ]
then
echo "Sleeping for ${SLEEP_FOR_GANACHE}"
rm -f /ocean-contracts/artifacts/ready
#we have to sleep until ganache is ready
sleep ${SLEEP_FOR_GANACHE}
cp hardhat.config.barge.js hardhat.config.js
export NETWORK="${NETWORK_NAME:-barge}"
npx hardhat compile --force
npx hardhat clean
npx hardhat compile
#remove unneeded debug artifacts
find /ocean-contracts/artifacts/* -name "*.dbg.json" -type f -delete
#copy address.json
if [ -e /ocean-contracts/addresses/address.json ]
then cp -u /ocean-contracts/addresses/address.json /ocean-contracts/artifacts/
fi
node scripts/deploy-contracts.js

echo "Starting deployment process..."
node /ocean-contracts/scripts/deploy-contracts.js
# set flag to indicate contracts are ready
touch /ocean-contracts/artifacts/ready
fi
Expand All @@ -30,4 +32,4 @@ USER_ID=${LOCAL_USER_ID:-$EXECUTION_UID}
GROUP_ID=${LOCAL_GROUP_ID:-$EXECUTION_GID}
chown -R $USER_ID:$GROUP_ID /ocean-contracts/artifacts

tail -f /dev/null
tail -f /dev/null
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ocean-contracts
version = v1.1.14
version = v1.1.15
author = leucothia
author_email = devops@oceanprotocol.com
description = 🐳 Ocean Protocol L1 - v4
Expand Down

0 comments on commit d288e3f

Please sign in to comment.