Merge branch 'bvander/more-contract-migration-permissions' into 'master'

add permissions and move some pip installs

See merge request grassrootseconomics/cic-internal-integration!69
This commit is contained in:
Blair Vanderlugt 2021-03-16 05:34:20 +00:00
commit fc27dd6826
2 changed files with 22 additions and 15 deletions

View File

@ -1,3 +1,4 @@
# syntax = docker/dockerfile:1.2
FROM python:3.8.6-slim-buster as compile-image FROM python:3.8.6-slim-buster as compile-image
RUN apt-get update RUN apt-get update
@ -46,8 +47,6 @@ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh |
&& nvm install $NODE_VERSION \ && nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \ && nvm alias default $NODE_VERSION \
&& nvm use $NODE_VERSION && nvm use $NODE_VERSION
# So many ridiculously stupid issues with node in docker that take oceans of absolutely wasted time to resolve
# owner of these files is "1001" by default - wtf
# && chown -R root:root "$NVM_DIR/versions/node/v$NODE_VERSION" # && chown -R root:root "$NVM_DIR/versions/node/v$NODE_VERSION"
ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules
@ -55,11 +54,21 @@ ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH
# RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version # RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version
RUN useradd --create-home grassroots
WORKDIR /home/grassroots
USER grassroots
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
ARG cic_base_version=0.1.1a23 ARG cic_base_version=0.1.1a23
ARG cic_registry_version=0.5.3a24 ARG cic_registry_version=0.5.3a24
RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version ARG cic_eth_version=0.10.0a41
RUN pip install --user --extra-index-url $pip_extra_index_url cic-registry==$cic_registry_version ARG chainlib_version=0.0.1a21
ARG cic_contracts_version=0.0.2a2
RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \
cic-registry==$cic_registry_version \
cic-eth==$cic_eth_version \
chainlib==$chainlib_version \
cic-contracts==$cic_contracts_version
# ARG cic_bancor_url=https://gitlab.com/grassrootseconomics/cic-bancor.git/ # ARG cic_bancor_url=https://gitlab.com/grassrootseconomics/cic-bancor.git/
# ARG cic_bancor_contracts_url=https://github.com/bancorprotocol/contracts-solidity # ARG cic_bancor_contracts_url=https://github.com/bancorprotocol/contracts-solidity
@ -101,17 +110,17 @@ RUN pip install --user --extra-index-url $pip_extra_index_url cic-registry==$ci
FROM python:3.8.6-slim-buster as runtime-image FROM python:3.8.6-slim-buster as runtime-image
RUN apt-get update
RUN apt-get install -y --no-install-recommends gnupg
COPY --from=compile-image /usr/local/bin/ /usr/local/bin/ COPY --from=compile-image /usr/local/bin/ /usr/local/bin/
COPY --from=compile-image /usr/local/etc/cic/ /usr/local/etc/cic/ COPY --from=compile-image /usr/local/etc/cic/ /usr/local/etc/cic/
ENV HOME /home/grassroots
RUN useradd --create-home grassroots RUN useradd --create-home grassroots
WORKDIR $HOME WORKDIR /home/grassroots
# COPY python dependencies to user dir # COPY python dependencies to user dir
COPY --from=compile-image /root/.local .local COPY --from=compile-image /home/grassroots/.local .local
ENV PATH=$HOME/.local/bin:$PATH ENV PATH=/home/grassroots/.local/bin:$PATH
# RUN chown grassroots:grassroots $HOME/.local/
COPY contract-migration/testdata/pgp testdata/pgp COPY contract-migration/testdata/pgp testdata/pgp
COPY contract-migration/wait-for-it.sh . COPY contract-migration/wait-for-it.sh .
@ -122,8 +131,9 @@ COPY contract-migration/sarafu_declaration.json sarafu_declaration.json
COPY contract-migration/keystore keystore COPY contract-migration/keystore keystore
COPY contract-migration/envlist . COPY contract-migration/envlist .
# critically, includes the .local folder from compile-image # RUN chown grassroots:grassroots .local/
RUN chown -R grassroots:grassroots . RUN chown grassroots:grassroots ./
RUN chmod gu+x *.sh
RUN mkdir -p /tmp/cic/config RUN mkdir -p /tmp/cic/config
RUN chown grassroots:grassroots /tmp/cic/config RUN chown grassroots:grassroots /tmp/cic/config

3
apps/contract-migration/seed_cic_eth.sh Normal file → Executable file
View File

@ -30,9 +30,6 @@ truncate $env_out_file -s 0
set -e set -e
set -a set -a
# We need to not install these here...
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a41 chainlib==0.0.1a21 cic-contracts==0.0.2a2
>&2 echo "create account for gas gifter" >&2 echo "create account for gas gifter"
old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER
DEV_ETH_ACCOUNT_GAS_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` DEV_ETH_ACCOUNT_GAS_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`