Skip to content
Snippets Groups Projects
Commit 6efbaa4b authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Many changes, also to accomodate for the new namespace

parent b5d20fae
No related branches found
No related tags found
No related merge requests found
FROM ethereum/solc:0.5.10-alpine AS solc FROM bfaar/nodo:toolbase
FROM ethereum/client-go:alltools-v1.9.2
LABEL maintainer="Robert Martin-Legene <robert@nic.ar>" LABEL maintainer="Robert Martin-Legene <robert@nic.ar>"
HEALTHCHECK --start-period=15s CMD [ "/usr/bin/nc", "-z", "-w", "2", "127.0.0.1", "8545" ] HEALTHCHECK --start-period=15s CMD [ "/usr/bin/nc", "-z", "-w", "2", "127.0.0.1", "8545" ]
CMD [ "/home/bfa/bfa/bin/singlestart.sh" ] CMD [ "/home/bfa/bfa/bin/singlestart.sh" ]
COPY --from=solc /usr/local/bin/solc /usr/local/bin
EXPOSE 8545 8546 30303 EXPOSE 8545 8546 30303
ENV USERNAME=bfa HOME=/home/bfa ENV USERNAME=bfa HOME=/home/bfa
ENV BFAHOME=${HOME}/bfa BFANETWORKIDPROD=47525974938 BFANETWORKIDTEST=55555000000 VIRTUALIZATION=DOCKER ENV BFAHOME=${HOME}/bfa BFANETWORKIDPROD=47525974938 BFANETWORKIDTEST=55555000000 VIRTUALIZATION=DOCKER GITBRANCH=__GITBRANCH__
ENV BFANETWORKDIRPROD=${BFAHOME}/network BFANETWORKDIRTEST=${BFAHOME}/test2network PATH=${BFAHOME}/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV BFANETWORKDIRPROD=${BFAHOME}/network BFANETWORKDIRTEST=${BFAHOME}/test2network PATH=${BFAHOME}/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN adduser -u 30303 -s /bin/bash -h ${HOME} -D ${USERNAME} ${USERNAME} && apk add --no-cache git bash jq perl perl-class-accessor perl-json perl-json-xs perl-lwp-protocol-https nodejs npm binutils python3 curl && rm -f /var/cache/apk/* ENV BFANETWORKID=__BFANETWORKID__ BFANETWORKDIR=__BFANETWORKDIR__ GITBRANCH=__GITBRANCH__
USER ${USERNAME}
WORKDIR ${HOME}
RUN git clone --quiet https://gitlab.bfa.ar/blockchain/nucleo.git ${BFAHOME} && cd ${BFAHOME} && npm install --no-optional && npm audit fix
ENV BFANETWORKID=${BFANETWORKIDPROD} BFANETWORKDIR=${BFANETWORKDIRPROD}
ENV BFANODEDIR=${BFANETWORKDIR}/node BFATOML=${BFANETWORKDIR}/config.toml ENV BFANODEDIR=${BFANETWORKDIR}/node BFATOML=${BFANETWORKDIR}/config.toml
RUN mkdir -p ${BFANODEDIR} && ln -s ${BFANODEDIR} .ethereum RUN mkdir ${BFANODEDIR} && ln -s ${BFANODEDIR} ${HOME}/.ethereum
USER ${USERNAME}
WORKDIR ${BFAHOME} WORKDIR ${BFAHOME}
RUN git pull && git checkout ipc RUN git checkout ${GITBRANCH} && git pull
VOLUME [ "/home/bfa" ] #VOLUME [ "/home/bfa" ]
FROM ethereum/solc:0.5.10-alpine AS solc
FROM ethereum/client-go:alltools-v1.9.2
LABEL maintainer="Robert Martin-Legene <robert@nic.ar>"
CMD [ "/bin/bash" ]
COPY --from=solc /usr/local/bin/solc /usr/local/bin
EXPOSE 8545 8546 30303
ENV USERNAME=bfa HOME=/home/bfa BFAHOME=/home/bfa/bfa BFANETWORKIDPROD=47525974938 BFANETWORKIDTEST=55555000000 VIRTUALIZATION=DOCKER BFANETWORKDIRPROD=/home/bfa/bfa/network BFANETWORKDIRTEST=/home/bfa/bfa/test2network PATH=/home/bfa/bfa/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN adduser -u 30303 -s /bin/bash -h ${HOME} -D ${USERNAME} ${USERNAME} && apk add --no-cache git bash jq perl perl-class-accessor perl-json perl-json-xs perl-lwp-protocol-https nodejs npm binutils python3 curl && find /var/cache/apk -type f -delete
USER ${USERNAME}
WORKDIR ${HOME}
RUN git clone --quiet https://gitlab.bfa.ar/blockchain/nucleo.git ${BFAHOME} && cd ${BFAHOME} && npm install --no-optional && npm audit fix
# toolbase
Este container paquete contiene herramientas que son muy paracidos
para la `bfaar/nodo:latest` y `bfaar/nodo:test`
Probablemente no tenes que usarlo directamente, ni pensar que existe.
#!/bin/bash
# 20190829 Robert Martin-Legene
trap "exit 1" ERR
TAG=toolbase
docker build --no-cache -t bfaar/nodo:${TAG} .
read -p 'Upload? : ' -n 1
echo
test "$REPLY" = "y" || exit 0
docker push bfaar/nodo:${TAG}
#!/bin/bash #!/bin/bash
# 20190829 Robert Martin-Legene # 20190829 Robert Martin-Legene
# This builds the docker bfanode on a Debian host system. # This builds the docker bfanode on a Debian host system.
# If on another distribution, maybe you need to find docker-squash with pip3
trap "exit 1" ERR trap "exit 1" ERR
TAG=latest OK=0
DOCKERFILENAME=Dockerfile TAG="$1"
if [ "$1" == "test" ] while [ "$OK" = "0" ]
then do
TAG=test case "$TAG" in
DOCKERFILENAME=Dockerfile-${TAG} "latest")
sed 's/BFANETWORKID=..BFANETWORKIDPROD. BFANETWORKDIR=..BFANETWORKDIRPROD./BFANETWORKID=${BFANETWORKIDTEST} BFANETWORKDIR=${BFANETWORKDIRTEST}/' < Dockerfile > ${DOCKERFILENAME} DOCKERFILENAME=Dockerfile-${TAG}
fi sed '
docker build -f ${DOCKERFILENAME} -t bfanode:${TAG} . s/BFANETWORKID=__BFANETWORKID__/BFANETWORKID=$BFANETWORKIDPROD/;
rm -f Dockerfile-test || true s/BFANETWORKDIR=__BFANETWORKDIR__/BFANETWORKDIR=$BFANETWORKDIRPROD/;
docker tag bfanode:${TAG} rlegene/bfanode:${TAG} s/GITBRANCH=__GITBRANCH__/GITBRANCH=master/
' < Dockerfile > ${DOCKERFILENAME}
OK=1
;;
"test")
DOCKERFILENAME=Dockerfile-${TAG}
sed '
s/BFANETWORKID=__BFANETWORKID__/BFANETWORKID=$BFANETWORKIDTEST/;
s/BFANETWORKDIR=__BFANETWORKDIR__/BFANETWORKDIR=$BFANETWORKDIRTEST/;
s/GITBRANCH=__GITBRANCH__/GITBRANCH=dev/
' < Dockerfile > ${DOCKERFILENAME}
OK=1
;;
*)
read -p 'Build which tag (latest/test)? : ' TAG
;;
esac
done
docker build --no-cache -f ${DOCKERFILENAME} -t bfaar/nodo:${TAG} .
rm Dockerfile-${TAG}
if [ "$USER" = "robert" ] if [ "$USER" = "robert" ]
then then
read -p 'Upload? : ' -n 1 read -p 'Upload? : ' -n 1
echo echo
test "$REPLY" = "y" || exit 0 test "$REPLY" = "y" || exit 0
docker push rlegene/bfanode:${TAG} || ( echo "Did you remember to log in using 'docker login'?" ; false ) docker push bfaar/nodo:${TAG} || ( echo "Did you remember to log in using 'docker login'?" ; false )
## Some day maybe we will have our own working registry.
#docker tag bfanode:${TAG} registry.gitlab.bfa.ar:5005/blockchain/bfanode:${TAG}
#docker push registry.gitlab.bfa.ar:5005/blockchain/bfanode:${TAG} || ( echo "Did you remember to log in using 'docker login'?" ; false )
fi fi
...@@ -12,25 +12,40 @@ if [ "$1" = "test" ] ...@@ -12,25 +12,40 @@ if [ "$1" = "test" ]
then then
tag="test" tag="test"
class="test" class="test"
name="bfanodotest" name="bfaarnodotest"
netdir="test2network" netdir="test2network"
else elif [ "$1" = "latest" ]
then
tag="latest" tag="latest"
class="prod" class="prod"
name="bfanodo" name="bfaarnodo"
netdir="network" netdir="network"
else
echo Argument 1 must be either latest or test. >&2
exit 1
fi fi
vd="${HOME}/dockers/volumes/${name},home,bfa,bfa,${netdir},node,geth" mounts=
mkdir -p "${vd}" for guestdir in /home/bfa/bfa/${netdir}/node /home/bfa/bfa/${netdir}/cache
mounts="-v ${vd}:/home/bfa/bfa/${netdir}/node/geth" do
# docker dirs
d_dirs="${d_dirs} ${guestdir}"
# guestdirs
g_dir=${guestdir//\//,}
g_dirs="${g_dirs} ${g_dir}"
# hostdirs
h_dir=${HOME}/dockers/volumes/${name}${guestdir//\//,}
h_dirs="${h_dirs} ${h_dir}"
mkdir -p ${h_dir}
mounts="${mounts} -v ${h_dir}:${guestdir}"
done
if [ "$UID" = "0" ] if [ "$UID" = "0" ]
then then
chown -R 30303:30303 ${vd} chown -R 30303:30303 ${h_dirs}
else else
# This is a bit slower, but works # This is a bit slower, but works
docker run --rm $mounts -u root alpine chown -R 30303:30303 /home/bfa/bfa/${netdir} docker run --rm $mounts -u root alpine chown -R 30303:30303 ${d_dirs}
fi fi
# Run this just a single time. # Run this just a single time.
...@@ -44,4 +59,4 @@ docker run \ ...@@ -44,4 +59,4 @@ docker run \
-p 8546:8546 \ -p 8546:8546 \
-p 30303:30303 \ -p 30303:30303 \
--name ${name} \ --name ${name} \
rlegene/bfanode:${tag} bfaar/nodo:${tag}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment