Refactored docker images. (#331)

This commit is contained in:
Ravin Perera
2021-07-14 16:27:17 +05:30
committed by GitHub
parent 7ba84e8e7a
commit 4790c7951c
8 changed files with 38 additions and 51 deletions

View File

@@ -20,15 +20,6 @@ sudo cp -r $cmake/bin/* /usr/local/bin/
sudo cp -r $cmake/share/* /usr/local/share/
rm $cmake.tar.gz && rm -r $cmake
# Libsodium
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz
tar -zxvf libsodium-1.0.18-stable.tar.gz
pushd libsodium-stable > /dev/null 2>&1
./configure && make
sudo make install
popd > /dev/null 2>&1
rm libsodium-1.0.18-stable.tar.gz && rm -r libsodium-stable
# Blake3
git clone https://github.com/BLAKE3-team/BLAKE3.git
pushd BLAKE3/c > /dev/null 2>&1
@@ -63,19 +54,6 @@ sudo chmod +x /usr/local/bin/flatc
popd > /dev/null 2>&1
rm v1.12.0.tar.gz && rm -r flatbuffers-1.12.0
# libfuse
sudo apt-get install -y meson ninja-build pkg-config
wget https://github.com/libfuse/libfuse/archive/fuse-3.8.0.tar.gz
tar -zxvf fuse-3.8.0.tar.gz
pushd libfuse-fuse-3.8.0 > /dev/null 2>&1
mkdir build
pushd build > /dev/null 2>&1
meson .. && ninja
sudo ninja install
popd > /dev/null 2>&1
popd > /dev/null 2>&1
rm fuse-3.8.0.tar.gz && rm -r libfuse-fuse-3.8.0
# Reader-Writer queue
wget https://github.com/cameron314/readerwriterqueue/archive/v1.0.3.tar.gz
tar -zxvf v1.0.3.tar.gz
@@ -104,11 +82,12 @@ sudo cp -r include/plog /usr/local/include/
popd > /dev/null 2>&1
rm 1.1.5.tar.gz && rm -r plog-1.1.5
# Boost stacktrace
sudo apt-get install -y libboost-stacktrace-dev
# Sqlite
sudo apt-get install -y sqlite3 libsqlite3-dev
# Library dependencies.
sudo apt-get install -y \
libsodium-dev \
sqlite3 libsqlite3-dev \
libboost-stacktrace-dev \
fuse3
# jq command (needed for remote cluster scripts)
sudo apt-get install -y jq

View File

@@ -1075,7 +1075,7 @@ namespace consensus
}
}
if (winning_votes < 2) // min_votes_required
if (winning_votes < min_votes_required)
{
LOG_INFO << "No consensus on last shard hash. Possible fork condition. won:" << winning_votes << " needed:" << min_votes_required;
return false;

View File

@@ -1 +0,0 @@
bin

View File

@@ -3,12 +3,14 @@
FROM ubuntu:focal
COPY libblake3.so /usr/local/lib/
RUN apt-get update && apt-get install -y \
libssl1.1 \
sqlite3 \
fuse3
RUN mkdir /usr/local/bin/hotpocket
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
libssl1.1 \
sqlite3 \
fuse3 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /usr/local/bin/hotpocket
COPY hpcore hpfs hpws appbill /usr/local/bin/hotpocket/
ENTRYPOINT ["/usr/local/bin/hotpocket/hpcore"]

View File

@@ -0,0 +1,6 @@
# HotPocket (Ubuntu 20.04) + NodeJs
FROM hotpocketdev/hotpocket:ubt.20.04
# Copy the node binary from build context to the container image.
COPY node /usr/bin/

View File

@@ -1,7 +0,0 @@
# HotPocket (Ubuntu 20.04) + NodeJs 14.x
FROM hotpocketdev/hotpocket:ubt.20.04
RUN apt-get install -y curl
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

View File

@@ -3,12 +3,20 @@
hpcoredir=$(realpath ../..)
repo=hotpocketdev/hotpocket
# Build base Ubuntu image.
mkdir -p bin
cp $hpcoredir/build/{hpcore,appbill} $hpcoredir/test/bin/{hpfs,hpws,libblake3.so} ./bin/
strip ./bin/hpcore
docker build -t $repo:ubt.20.04 -f ./Dockerfile.ubt.20.04 ./bin
rm -r bin
# Prepare build context
tmp=$(mktemp -d)
cp $hpcoredir/build/{hpcore,appbill} $hpcoredir/test/bin/{hpfs,hpws,libblake3.so} $tmp/
strip $tmp/hpcore
# NodeJs image.
docker build -t $repo:ubt.20.04-njs.14 -f ./Dockerfile.ubt.20.04-njs.14 .
# Ubuntu base image
docker build -t $repo:ubt.20.04 -f ./Dockerfile.ubt.20.04 $tmp/
rm -r $tmp/*
# NodeJs image
# Download and place the nodejs binary in the build context.
curl -fsSL -o $tmp/nodejs.tar.xz https://nodejs.org/dist/v14.17.3/node-v14.17.3-linux-x64.tar.xz
tar -xvJf $tmp/nodejs.tar.xz --strip-components=2 -C $tmp/ node-v14.17.3-linux-x64/bin/node
rm $tmp/nodejs.tar.xz
docker build -t $repo:ubt.20.04-njs.14 -f ./Dockerfile.ubt.20.04-njs $tmp
rm -r $tmp

View File

@@ -7,5 +7,5 @@ ENTRYPOINT ["/usr/local/bin/hotpocket/hpcore"]
# Run with valgrind
# RUN apt-get install -y gdb valgrind
# RUN apt-get install --no-install-recommends -y gdb valgrind
# ENTRYPOINT ["valgrind", "/usr/local/bin/hotpocket/hpcore"]