Skip to content

Commit

Permalink
Merge pull request #41 from PaskLab/development
Browse files Browse the repository at this point in the history
Updated to support v9.2.x
  • Loading branch information
pascallapointe authored Sep 29, 2024
2 parents e2c33f1 + f6345a0 commit 85f0c3d
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 122 deletions.
8 changes: 4 additions & 4 deletions Dockerfiles/build_env/aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WORKDIR /root
RUN apt-get update && \
apt-get install -y apt-utils git wget curl pkg-config \
libgmp-dev libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev \
libsodium-dev zlib1g-dev llvm-14 automake make build-essential \
zlib1g-dev llvm-dev automake make build-essential \
libffi-dev libncursesw5 g++ jq libnuma-dev libtool autoconf

# Install Rust
Expand All @@ -34,7 +34,7 @@ RUN git clone https://github.com/bitcoin-core/secp256k1.git

WORKDIR /root/secp256k1

RUN git reset --hard ac83be33d0956faf6b7f61a60ab524ef7d6a473a &&\
RUN git checkout v0.3.2 &&\
./autogen.sh &&\
./configure --enable-module-schnorrsig --enable-experimental &&\
make &&\
Expand All @@ -46,7 +46,7 @@ WORKDIR /root
RUN git clone https://github.com/input-output-hk/libsodium

WORKDIR /root/libsodium
RUN git checkout dbb48cc &&\
RUN git checkout dbb48cce5429cb6585c9034f002568964f1ce567 &&\
./autogen.sh &&\
./configure &&\
make &&\
Expand All @@ -60,7 +60,7 @@ WORKDIR /root
# Install BLST dependencies
RUN git clone https://github.com/supranational/blst
WORKDIR /root/blst
RUN git checkout v0.3.10 &&\
RUN git checkout v0.3.11 &&\
./build.sh
COPY files/libblst.pc /usr/local/lib/pkgconfig/libblst.pc
RUN cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/ &&\
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/build_env/x86_64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WORKDIR /root
RUN apt-get update && \
apt-get install -y apt-utils git wget curl pkg-config \
libgmp-dev libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev \
libsodium-dev zlib1g-dev llvm-14 automake make build-essential \
zlib1g-dev llvm-dev automake make build-essential \
libffi-dev libncursesw5 g++ jq libnuma-dev libtool autoconf

# Install Rust
Expand Down
84 changes: 36 additions & 48 deletions Dockerfiles/db-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
FROM cardano_env
FROM cardano_env AS base

LABEL name="cardano_node"
LABEL description="Cardano node"
LABEL name="db_sync"
LABEL description="Cardano DB Sync"
LABEL maintainer="https://github.com/pascallapointe"

WORKDIR /root

# Install base utilities and dependencies
RUN apt-get update
RUN apt-get install -y libghc-postgresql-libpq-dev
RUN apt-get install -y libpq5
RUN apt-get install -y postgresql postgresql-contrib
RUN apt-get update && \
apt-get install -y libpq-dev postgresql-client

# Download cardano-node repository
# Download Db-Sync repository
ARG RELEASE
ARG ARCHITECTURE
ARG PGPASSFILE="config/pgpass-mainnet scripts/postgresql-setup.sh --createdb"
RUN git clone https://github.com/input-output-hk/cardano-db-sync
WORKDIR /root/cardano-db-sync
RUN git checkout ${RELEASE}
RUN git checkout ${RELEASE} && git submodule update --init --recursive

# Build cardano-node binary
RUN cabal update
RUN cabal build cardano-db-sync
RUN cabal build all
# Build db-sync binary
RUN cabal update && \
cabal user-config update && \
cabal build cardano-db-sync --disable-tests && \
cabal build cardano-db-tool --disable-tests

# Create files structure
RUN mkdir -p /cardano/config /cardano/bin /cardano/ledger-state
ARG ARCHITECTURE
ARG RELEASE_PATH=$RELEASE
ARG GHC_VERSION=ghc-9.6.4
RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-db-sync-${RELEASE_PATH}/build/cardano-db-sync/cardano-db-sync /cardano/bin
RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-db-tool-${RELEASE_PATH}/x/cardano-db-tool/build/cardano-db-tool/cardano-db-tool /cardano/bin
RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-db-sync-${RELEASE_PATH}/build/cardano-db-sync/cardano-db-sync /cardano/bin && \
cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-db-tool-${RELEASE_PATH}/x/cardano-db-tool/build/cardano-db-tool/cardano-db-tool /cardano/bin

WORKDIR /root
RUN mv cardano-db-sync/schema /cardano/.
Expand All @@ -39,44 +38,33 @@ RUN mv cardano-db-sync/schema /cardano/.
COPY files/start.sh /cardano/scripts/start.sh
COPY files/sleep.sh /cardano/scripts/sleep.sh

# Creating non root user cardano
RUN useradd -m cardano

# Add permissions
RUN chown -R cardano:cardano /cardano
RUN chmod g+s /cardano
RUN chmod 540 /cardano/scripts/*
RUN chmod 540 /cardano/bin/*

ENV PATH=/cardano/scripts:/cardano/bin:$PATH
RUN chmod g+s /cardano && \
chmod 540 /cardano/scripts/* && \
chmod 540 /cardano/bin/*

# Image clean-up
WORKDIR /root

#RUN cabal clean
RUN rm -rf cardano-db-sync
RUN rm -rf .cabal .local
RUN apt-get purge -y apt-utils
RUN apt-get purge -y git
RUN apt-get purge -y wget
RUN apt-get purge -y pkg-config
RUN apt-get purge -y libgmp-dev
RUN apt-get purge -y libssl-dev
RUN apt-get purge -y libtinfo-dev
RUN apt-get purge -y libsystemd-dev
RUN apt-get purge -y zlib1g-dev
RUN apt-get purge -y llvm
RUN apt-get purge -y build-essential
RUN apt-get purge -y libffi-dev
RUN apt-get purge -y make
RUN apt-get purge -y g++

RUN apt-get autoremove -y
RUN apt-get clean
RUN apt-get autoclean

# Switch user
USER cardano:cardano
RUN rm -rf cardano-db-sync && \
rm -rf .cabal .local && \
apt-get purge -y apt-utils git wget pkg-config libgmp-dev \
libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev libtool \
zlib1g-dev llvm-dev build-essential libffi-dev automake \
make g++ libncursesw5 jq autoconf libpq-dev &&\
apt-get autoremove -y && \
apt-get clean && \
apt-get autoclean

FROM ubuntu:jammy
COPY --from=base / /

ENV PATH=/cardano/scripts:/cardano/bin:$PATH
ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

WORKDIR /cardano

CMD ["/bin/bash", "-c", "start.sh"]
Expand Down
12 changes: 1 addition & 11 deletions Dockerfiles/mithril-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ WORKDIR /root/mithril
RUN git checkout ${MITHRIL_TAG}
WORKDIR /root/mithril/mithril-client-cli

# Support for Asahi Linux 16kb memory page, to be commented if not needed
#ENV JEMALLOC_SYS_WITH_LG_PAGE=16

# Build mithril binary
RUN make build
RUN cp mithril-client /cardano/bin

# Creating non root user cardano
# RUN useradd -m cardano

# Add permissions
# RUN chown -R cardano:cardano /cardano
RUN chmod g+s /cardano
RUN chmod 540 /cardano/bin/*
RUN chmod g+s /cardano && chmod 540 /cardano/bin/*

ENV PATH=/cardano/scripts:/cardano/bin:$PATH

Expand Down Expand Up @@ -58,8 +50,6 @@ ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

# Switch user
# USER cardano:cardano
WORKDIR /cardano

CMD ["/bin/bash", "-c", "tail","-f","/dev/null"]
15 changes: 2 additions & 13 deletions Dockerfiles/mithril-signer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ WORKDIR /root/cardano-cli
ARG GHC_VERSION=ghc-9.6.4
RUN git checkout cardano-cli-${CLI_TAG} && git submodule update --init --recursive

# Add cabal config files
RUN echo 'jobs: 4\npackage cardano-crypto-praos\n flags: +external-libsodium-vrf\n' > /root/cardano-cli/cabal.project.local

# Build cardano-node binary
# Build cardano-cli binary
RUN cabal update && cabal user-config update && cabal build cardano-cli --disable-tests
RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-cli-${CLI_TAG}/x/cardano-cli/build/cardano-cli/cardano-cli /cardano/bin

Expand All @@ -43,14 +40,8 @@ RUN mkdir -p /cardano/stores
# Add startup scripts
COPY files/start.sh /cardano/scripts/start.sh

# Creating non root user cardano
# RUN useradd -m cardano

# Add permissions
# RUN chown -R cardano:cardano /cardano
RUN chmod g+s /cardano
RUN chmod 540 /cardano/scripts/*
RUN chmod 540 /cardano/bin/*
RUN chmod g+s /cardano && chmod 540 /cardano/scripts/* && chmod 540 /cardano/bin/*

ENV PATH=/cardano/scripts:/cardano/bin:$PATH
ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
Expand Down Expand Up @@ -83,8 +74,6 @@ ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

# Switch user
# USER cardano:cardano
WORKDIR /cardano

CMD ["/bin/bash", "-c", "start.sh"]
24 changes: 6 additions & 18 deletions Dockerfiles/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ RUN git clone https://github.com/IntersectMBO/cardano-node.git
WORKDIR /root/cardano-node
RUN git checkout ${NODE_TAG} && git submodule update --init --recursive

# Add cabal config files
RUN echo 'jobs: 4\npackage cardano-crypto-praos\n flags: +external-libsodium-vrf\n' > /root/cardano-node/cabal.project.local

# Build cardano-node binary
RUN cabal update && cabal user-config update && cabal build cardano-node --disable-tests
RUN cabal update && cabal build cardano-node --disable-tests

# Create files structure
ARG GHC_VERSION=ghc-9.6.4
Expand All @@ -33,11 +30,8 @@ RUN git clone https://github.com/IntersectMBO/cardano-cli.git
WORKDIR /root/cardano-cli
RUN git checkout cardano-cli-${CLI_TAG} && git submodule update --init --recursive

# Add cabal config files
RUN echo 'jobs: 4\npackage cardano-crypto-praos\n flags: +external-libsodium-vrf\n' > /root/cardano-cli/cabal.project.local

# Build cardano-node binary
RUN cabal update && cabal user-config update && cabal build cardano-cli --disable-tests
# Build cardano-cli binary
RUN cabal update && cabal build cardano-cli --disable-tests

RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-cli-${CLI_TAG}/x/cardano-cli/build/cardano-cli/cardano-cli /cardano/bin

Expand All @@ -50,11 +44,7 @@ COPY files/start-with-topology.sh /cardano/scripts/start-with-topology.sh
# USE CURL, DO NOT UNINSTALL CURL
COPY files/topologyUpdater.sh /cardano/scripts/topologyUpdater.sh

# Creating non root user cardano
# RUN useradd -m cardano

# Add permissions
# RUN chown -R cardano:cardano /cardano
RUN chmod g+s /cardano && chmod 540 /cardano/scripts/* && chmod 540 /cardano/bin/*

# Image clean-up
Expand All @@ -67,9 +57,9 @@ RUN cabal clean &&\
rm -rf .cabal .local .ghcup .ghc .cache ghcup &&\
rustup self uninstall -y &&\
apt-get purge -y apt-utils git wget pkg-config libgmp-dev \
libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev libtool \
zlib1g-dev llvm-14 build-essential libffi-dev automake \
make g++ libncursesw5 jq autoconf &&\
libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev libtool \
zlib1g-dev llvm-dev build-essential libffi-dev automake \
make g++ libncursesw5 jq autoconf &&\
apt-get autoremove -y &&\
apt-get clean &&\
apt-get autoclean
Expand All @@ -82,8 +72,6 @@ ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

# Switch user
# USER cardano:cardano
WORKDIR /cardano

CMD ["/bin/bash", "-c", "start-relay.sh"]
28 changes: 7 additions & 21 deletions Dockerfiles/submit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ ARG ARCHITECTURE
ARG NODE_TAG
RUN git clone https://github.com/input-output-hk/cardano-node
WORKDIR /root/cardano-node
RUN git checkout ${NODE_TAG}
RUN git submodule update --init --recursive
RUN git checkout ${NODE_TAG} && git submodule update --init --recursive

# Add cabal config files
COPY files/cabal.project.local /root/cardano-node/cabal.project.local

# Build cardano-node binary
RUN cabal update
RUN cabal user-config update
RUN cabal build exe:cardano-submit-api --disable-tests
# Build cardano-submit binary
RUN cabal update && cabal build exe:cardano-submit-api --disable-tests

# Create files structure
RUN mkdir -p /cardano/config /cardano/bin /cardano/db /cardano/socket /cardano/scripts
Expand All @@ -31,14 +25,8 @@ RUN cp -p dist-newstyle/build/${ARCHITECTURE}-linux/${GHC_VERSION}/cardano-submi
# Add startup scripts
COPY files/start.sh /cardano/scripts/start.sh

# Creating non root user cardano
#RUN useradd -m cardano

# Add permissions
#RUN chown -R cardano:cardano /cardano
RUN chmod g+s /cardano
RUN chmod 540 /cardano/scripts/*
RUN chmod 540 /cardano/bin/*
RUN chmod g+s /cardano && chmod 540 /cardano/scripts/* && chmod 540 /cardano/bin/*

ENV PATH=/cardano/scripts:/cardano/bin:$PATH

Expand All @@ -51,9 +39,9 @@ RUN cabal clean &&\
rm -rf .cabal .local .ghcup .ghc .cache ghcup &&\
rustup self uninstall -y &&\
apt-get purge -y apt-utils git wget pkg-config libgmp-dev \
libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev libtool \
zlib1g-dev llvm-14 build-essential libffi-dev automake \
make g++ libncursesw5 jq autoconf &&\
libssl-dev libtinfo-dev libsystemd-dev liblmdb-dev libtool \
zlib1g-dev llvm-dev build-essential libffi-dev automake \
make g++ libncursesw5 jq autoconf &&\
apt-get autoremove -y &&\
apt-get clean &&\
apt-get autoclean
Expand All @@ -66,8 +54,6 @@ ENV CARDANO_NODE_SOCKET_PATH=/cardano/socket/node.sock
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

# Switch user
#USER cardano:cardano
WORKDIR /cardano

CMD ["/bin/bash", "-c", "start.sh"]
3 changes: 0 additions & 3 deletions Dockerfiles/submit/files/cabal.project.local

This file was deleted.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Docker files for setting up Cardano Node environment.

### Building from source

Since we need our binary to work on Aarch64 architecture, you'll need to build the node from the source files.
Since we need our binary to work on aarch64 architecture, you'll need to build the node from the source files.
I've written a Dockerfile that simplify the process.

First, you need to build all required images:
Expand Down Expand Up @@ -78,10 +78,12 @@ First, you need to build all required images:
7. The DB-Sync image:

```bash
DBSYNC_TAG=<db-sync release tag>
docker build \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg RELEASE=${VERSION_NUMBER} \
-t cardano_db_sync:${VERSION_NUMBER} Dockerfiles/db-sync
--build-arg RELEASE=${DBSYNC_TAG} \
-t cardano_db_sync:${DBSYNC_TAG} Dockerfiles/db-sync
```

8. Tag your image with the **latest** tag:
Expand Down

0 comments on commit 85f0c3d

Please sign in to comment.