This commit is contained in:
Luke Parker 2023-09-19 12:55:30 -04:00
parent a9468bf355
commit e455332e01
No known key found for this signature in database
6 changed files with 95 additions and 13 deletions

View file

@ -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 \
@ -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

View file

@ -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
@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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