Skip to content

Commit

Permalink
Resolve #369
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Sep 19, 2023
1 parent a9468bf commit e455332
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 13 deletions.
19 changes: 17 additions & 2 deletions orchestration/coins/bitcoin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ ENV BITCOIN_DATA=/home/bitcoin/.bitcoin

WORKDIR /home/bitcoin

RUN apk update && \
apk --no-cache add ca-certificates bash su-exec git gnupg
RUN apk --no-cache add git gnupg

# Download Bitcoin
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \
Expand All @@ -27,8 +26,24 @@ RUN grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256s
RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
RUN mv bitcoin-${BITCOIN_VERSION}/bin/bitcoind .

# Also build mimalloc
FROM debian:bookworm-slim as mimalloc

RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

# Build the actual image
FROM debian:bookworm-slim as image

COPY --from=mimalloc libmimalloc.so /usr/lib
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload

# Upgrade packages
RUN apt update && apt upgrade -y && apt autoremove -y && apt clean

Expand Down
17 changes: 14 additions & 3 deletions orchestration/coins/monero/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ ENV GLIBC_VERSION=2.28-r0

WORKDIR /home/monero

RUN apk update \
&& apk --no-cache add ca-certificates gnupg bash su-exec
RUN apk update && apk --no-cache add gcc g++ libc-dev make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

RUN apk --no-cache add gnupg

# Download Monero
RUN wget https://downloads.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2
Expand All @@ -29,8 +37,11 @@ RUN tar -xvjf monero-linux-x64-v${MONERO_VERSION}.tar.bz2 --strip-components=1
# Build the actual image
FROM alpine:latest as image

COPY --from=builder /home/monero/libmimalloc.so /usr/lib
ENV LD_PRELOAD=libmimalloc.so

# Upgrade packages
RUN apk update && apk upgrade && apk add gcompat
RUN apk update && apk upgrade && apk --no-cache add gcompat

# Switch to a non-root user
# System user (not a human), shell of nologin, no password assigned
Expand Down
18 changes: 16 additions & 2 deletions orchestration/coordinator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ RUN --mount=type=cache,target=/root/.cargo \
mkdir /serai/bin && \
mv /serai/target/release/serai-coordinator /serai/bin

# Prepare Image
# Also build mimalloc
FROM debian:bookworm-slim as mimalloc

RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

# Build the actual image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"

COPY --from=mimalloc libmimalloc.so /usr/lib
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload

# Upgrade packages and install openssl
RUN apt update && apt upgrade -y && apt install -y libssl-dev && apt autoremove && apt clean
Expand Down
18 changes: 16 additions & 2 deletions orchestration/message-queue/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,23 @@ RUN --mount=type=cache,target=/root/.cargo \
mkdir /serai/bin && \
mv /serai/target/release/serai-message-queue /serai/bin

# Prepare Image
# Also build mimalloc
FROM debian:bookworm-slim as mimalloc

RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

# Build the actual image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"

COPY --from=mimalloc libmimalloc.so /usr/lib
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload

# Upgrade packages
RUN apt update && apt upgrade -y
Expand Down
18 changes: 16 additions & 2 deletions orchestration/processor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ RUN --mount=type=cache,target=/root/.cargo \
mkdir /serai/bin && \
mv /serai/target/release/serai-processor /serai/bin

# Prepare Image
# Also build mimalloc
FROM debian:bookworm-slim as mimalloc

RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

# Build the actual image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"

COPY --from=mimalloc libmimalloc.so /usr/lib
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload

# Upgrade packages and install openssl
RUN apt update && apt upgrade -y && apt install -y libssl-dev
Expand Down
18 changes: 16 additions & 2 deletions orchestration/serai/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ RUN --mount=type=cache,target=/root/.cargo \
mkdir /serai/bin && \
mv /serai/target/release/serai-node /serai/bin

# Prepare Image
# Also build mimalloc
FROM debian:bookworm-slim as mimalloc

RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
RUN git clone https://github.com/microsoft/mimalloc && \
cd mimalloc && \
mkdir -p out/secure && \
cd out/secure && \
cmake -DMI_SECURE=ON ../.. && \
make && \
cp ./libmimalloc-secure.so ../../../libmimalloc.so

# Build the actual image
FROM debian:bookworm-slim as image
LABEL description="STAGE 2: Copy and Run"

COPY --from=mimalloc libmimalloc.so /usr/lib
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload

# Upgrade packages
RUN apt update && apt upgrade -y
Expand Down

0 comments on commit e455332

Please sign in to comment.