2021-03-16 06:34:19 +01:00
|
|
|
# syntax = docker/dockerfile:1.2
|
2021-03-13 19:50:36 +01:00
|
|
|
FROM python:3.8.6-slim-buster as compile-image
|
2021-01-24 21:16:22 +01:00
|
|
|
|
2021-03-13 19:50:36 +01:00
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y --no-install-recommends git gcc g++ libpq-dev gawk jq telnet wget openssl iputils-ping gnupg socat bash procps make python2 cargo
|
2021-01-24 21:16:22 +01:00
|
|
|
|
2021-04-28 06:01:58 +02:00
|
|
|
RUN touch /etc/apt/sources.list.d/ethereum.list
|
|
|
|
RUN echo 'deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' > /etc/apt/sources.list.d/ethereum.list
|
|
|
|
RUN echo 'deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' >> /etc/apt/sources.list.d/ethereum.list
|
|
|
|
|
|
|
|
RUN cat etc/apt/sources.list.d/ethereum.list
|
|
|
|
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9
|
|
|
|
|
2021-03-13 19:50:36 +01:00
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install solc
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
RUN mkdir -vp /usr/local/etc/cic
|
|
|
|
|
|
|
|
COPY contract-migration/nvm.sh .
|
|
|
|
ENV CONFINI_DIR /usr/local/etc/cic/
|
|
|
|
RUN mkdir -vp $CONFINI_DIR
|
2021-01-24 21:16:22 +01:00
|
|
|
|
2021-02-10 08:03:11 +01:00
|
|
|
ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf
|
2021-01-24 21:16:22 +01:00
|
|
|
ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/
|
|
|
|
RUN echo Install confini schema files && \
|
|
|
|
git clone --depth 1 $cic_config_url cic-config && \
|
|
|
|
cd cic-config && \
|
|
|
|
git fetch --depth 1 origin $cic_config_commit && \
|
2021-03-13 19:50:36 +01:00
|
|
|
git checkout $cic_config_commit && \
|
|
|
|
cp -v *.ini $CONFINI_DIR
|
2021-01-24 21:16:22 +01:00
|
|
|
|
|
|
|
# Install nvm with node and npm
|
|
|
|
# https://stackoverflow.com/questions/25899912/how-to-install-nvm-in-docker
|
|
|
|
ENV NVM_DIR /root/.nvm
|
|
|
|
ENV NODE_VERSION 15.3.0
|
|
|
|
ENV BANCOR_NODE_VERSION 10.16.0
|
|
|
|
|
|
|
|
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash \
|
|
|
|
&& . $NVM_DIR/nvm.sh \
|
|
|
|
&& nvm install $NODE_VERSION \
|
|
|
|
&& nvm alias default $NODE_VERSION \
|
2021-03-13 19:50:36 +01:00
|
|
|
&& nvm use $NODE_VERSION
|
|
|
|
# && chown -R root:root "$NVM_DIR/versions/node/v$NODE_VERSION"
|
2021-01-24 21:16:22 +01:00
|
|
|
|
|
|
|
ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules
|
|
|
|
ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH
|
|
|
|
|
2021-05-02 18:56:08 +02:00
|
|
|
#RUN useradd --create-home grassroots
|
|
|
|
# WORKDIR /home/grassroots
|
|
|
|
# USER grassroots
|
2021-03-16 06:34:19 +01:00
|
|
|
|
2021-01-24 21:16:22 +01:00
|
|
|
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
|
2021-04-23 23:02:51 +02:00
|
|
|
ARG cic_base_version=0.1.2a79
|
|
|
|
ARG cic_eth_version=0.11.0b8+build.c2286e5c
|
2021-04-15 18:04:47 +02:00
|
|
|
ARG sarafu_faucet_version=0.0.2a28
|
2021-04-30 08:25:49 +02:00
|
|
|
ARG sarafu_token_version=0.0.1a6
|
2021-03-16 06:34:19 +01:00
|
|
|
ARG cic_contracts_version=0.0.2a2
|
2021-05-02 18:56:08 +02:00
|
|
|
RUN pip install --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \
|
2021-03-29 15:27:53 +02:00
|
|
|
cic-eth==$cic_eth_version \
|
|
|
|
cic-contracts==$cic_contracts_version \
|
2021-04-21 07:46:42 +02:00
|
|
|
sarafu-faucet==$sarafu_faucet_version \
|
|
|
|
sarafu-token==$sarafu_token_version
|
2021-03-13 19:50:36 +01:00
|
|
|
|
2021-05-02 18:56:08 +02:00
|
|
|
# -------------- begin runtime container ----------------
|
2021-03-13 19:50:36 +01:00
|
|
|
FROM python:3.8.6-slim-buster as runtime-image
|
|
|
|
|
2021-03-16 06:34:19 +01:00
|
|
|
RUN apt-get update
|
2021-04-21 07:46:42 +02:00
|
|
|
RUN apt-get install -y --no-install-recommends gnupg libpq-dev
|
2021-05-02 18:56:08 +02:00
|
|
|
RUN apt-get install -y jq bash iputils-ping socat
|
2021-03-16 06:34:19 +01:00
|
|
|
|
2021-03-13 19:50:36 +01:00
|
|
|
COPY --from=compile-image /usr/local/bin/ /usr/local/bin/
|
|
|
|
COPY --from=compile-image /usr/local/etc/cic/ /usr/local/etc/cic/
|
2021-05-02 18:56:08 +02:00
|
|
|
COPY --from=compile-image /usr/local/lib/python3.8/site-packages/ \
|
|
|
|
/usr/local/lib/python3.8/site-packages/
|
2021-03-13 19:50:36 +01:00
|
|
|
|
2021-05-02 18:56:08 +02:00
|
|
|
ENV EXTRA_INDEX_URL https://pip.grassrootseconomics.net:8433
|
|
|
|
# RUN useradd -u 1001 --create-home grassroots
|
|
|
|
# RUN adduser grassroots sudo && \
|
|
|
|
# echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
|
|
# WORKDIR /home/grassroots
|
2021-01-24 21:16:22 +01:00
|
|
|
|
2021-02-04 05:36:32 +01:00
|
|
|
COPY contract-migration/testdata/pgp testdata/pgp
|
2021-02-10 08:03:11 +01:00
|
|
|
COPY contract-migration/sarafu_declaration.json sarafu_declaration.json
|
2021-02-04 05:36:32 +01:00
|
|
|
COPY contract-migration/keystore keystore
|
2021-03-10 01:54:33 +01:00
|
|
|
COPY contract-migration/envlist .
|
2021-05-02 18:56:08 +02:00
|
|
|
COPY contract-migration/scripts scripts/
|
2021-01-24 21:16:22 +01:00
|
|
|
|
2021-03-15 15:10:08 +01:00
|
|
|
# A shared output dir for environment configs
|
2021-05-02 18:56:08 +02:00
|
|
|
RUN mkdir -p /tmp/cic/config
|
|
|
|
# RUN chown grassroots:grassroots /tmp/cic/config
|
2021-03-15 15:10:08 +01:00
|
|
|
RUN chmod a+rwx /tmp/cic/config
|
|
|
|
|
2021-03-29 15:27:53 +02:00
|
|
|
COPY contract-migration/*.sh ./
|
2021-05-02 18:56:08 +02:00
|
|
|
# RUN chown grassroots:grassroots -R .
|
2021-03-29 15:27:53 +02:00
|
|
|
RUN chmod gu+x *.sh
|
|
|
|
|
2021-05-02 18:56:08 +02:00
|
|
|
# we copied these from the root build container.
|
|
|
|
# this is dumb though...I guess the compile image should have the same user
|
|
|
|
# RUN chown grassroots:grassroots -R /usr/local/lib/python3.8/site-packages/
|
2021-03-29 15:27:53 +02:00
|
|
|
|
2021-05-02 18:56:08 +02:00
|
|
|
# USER grassroots
|
2021-03-15 15:10:08 +01:00
|
|
|
|
2021-03-13 19:50:36 +01:00
|
|
|
ENTRYPOINT [ ]
|