Skip to content

Commit

Permalink
Update Dockerfile (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
markopoloparadox authored Nov 29, 2023
1 parent 235ca8f commit a082093
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 88 deletions.
75 changes: 24 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,61 +1,35 @@
# syntax = docker/dockerfile:1.2

# Phase 0: Builder
# Phase 1: Builder
# =========================
FROM paritytech/ci-linux:1.69.0-bullseye as builder
FROM debian:12.2-slim as builder

# Install needed packages
RUN apt-get update && \
apt-get install -yqq --no-install-recommends git openssh-client && \
rm -rf /var/lib/apt/lists

# Install nightly Rust for WASM & prepare folders
# RUN rustup toolchain install nightly && \
# rustup target add wasm32-unknown-unknown --toolchain nightly && \
# rustup default nightly
RUN apt update -y && \
apt install build-essential git clang curl libssl-dev llvm libudev-dev make cmake protobuf-compiler -y

# Clone & build node binary.
ARG AVAIL_TAG=v1.6.0
RUN \
mkdir -p /da/state && \
mkdir -p /da/keystore && \
git clone -b $AVAIL_TAG --single-branch https://github.com/availproject/avail.git /da/src/ && \
cd /da/src && \
cargo build --release -p data-avail
WORKDIR "/da/src"

# Install binaries
RUN \
mkdir -p /da/bin && \
mv /da/src/misc/genesis /da && \
mv /da/src/target/release/data-avail /da/bin && \
# Clean src \
rm -rf /da/src
# Clone repo
ARG AVAIL_TAG=v1.8.0.2
RUN git clone -b $AVAIL_TAG --single-branch https://github.com/availproject/avail.git .

# Phase 1: Binary deploy
# =========================
FROM debian:bullseye-slim
# This installs Rust and updates Rust to the right version.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust_install.sh && chmod u+x rust_install.sh && ./rust_install.sh -y

RUN \
apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists && \
groupadd -r avail && \
useradd --no-log-init -r -g avail avail
# Build Binary at /da/src/data-avail
RUN $HOME/.cargo/bin/rustup show
RUN $HOME/.cargo/bin/cargo build --locked --release
RUN cp ./target/release/data-avail .

COPY --chown=avail.avail --from=builder /da/ /da
COPY --chown=avail.avail --chmod=755 entrypoint.sh /
# Phase 2: Binary deployment
# =========================
FROM debian:12.2-slim

ENV \
DA_CHAIN="/da/genesis/testnet.kate.chain.spec.raw.json" \
DA_NAME="AvailNode" \
LANG=C.UTF-8 \
DA_MAX_IN_PEERS=50 \
DA_MAX_OUT_PEERS=50 \
DA_P2P_PORT="30333"
RUN apt update -y
COPY --from=builder /da/src/data-avail /usr/local/bin/data-avail
RUN chmod +x /usr/local/bin/data-avail

# Opencontainers annotations
LABEL \
org.opencontainers.image.authors="The Avail Project Team" \
LABEL org.opencontainers.image.authors="The Avail Project Team" \
org.opencontainers.image.url="https://www.availproject.org/" \
org.opencontainers.image.documentation="https://github.com/availproject/avail-deployment#readme" \
org.opencontainers.image.source="https://github.com/availproject/avail-deployment" \
Expand All @@ -66,8 +40,7 @@ LABEL \
org.opencontainers.image.title="Avail Node" \
org.opencontainers.image.description="Data Availability Docker Node"

# USER avail:avail
WORKDIR /da
VOLUME ["/tmp", "/da/state", "/da/keystore"]
ENTRYPOINT ["/entrypoint.sh"]
VOLUME ["/da/node-data"]
ENTRYPOINT ["/usr/local/bin/data-avail"]
CMD ["--chain", "goldberg", "--tmp", "--name", "MyAwesomeAvailNodeInContainer"]

3 changes: 1 addition & 2 deletions dockerfiles/avail-node.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This is the first stage. Here we install all the dependencies that we need in order to build the Ternoa binary.
FROM ubuntu:22.04 as builder
FROM ubuntu:22.04

ADD . ./workdir
WORKDIR "/workdir"
Expand Down
35 changes: 0 additions & 35 deletions entrypoint.sh

This file was deleted.

2 comments on commit a082093

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a082093 Previous: 33f7951 Ratio
commitment_builder/32 4207579131 ns/iter (± 53590607) 4325417137 ns/iter (± 81695432) 0.97
commitment_builder/64 4213694965 ns/iter (± 73192009) 4343451680 ns/iter (± 92231152) 0.97
commitment_builder/128 4603143674 ns/iter (± 86708173) 4647446215 ns/iter (± 137494514) 0.99
commitment_builder/256 2269825028 ns/iter (± 24408507) 2367397557 ns/iter (± 42776582) 0.96

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a082093 Previous: 909af7f Ratio
commitment_builder_32 Instructions 43507952287 ops (± 0) 43503093041 ops (± 0) 1.00
commitment_builder_32 L1 Accesses 53520186969 ops (± 0) 53514815042 ops (± 0) 1.00
commitment_builder_32 L2 Accesses 704943 ops (± 0) 700403 ops (± 0) 1.01
commitment_builder_32 RAM Accesses 94440 ops (± 0) 89904 ops (± 0) 1.05
commitment_builder_32 Estimated Cycles 53527017084 ops (± 0) 53521463697 ops (± 0) 1.00
commitment_builder_64 Instructions 41976835797 ops (± 0) 41972869826 ops (± 0) 1.00
commitment_builder_64 L1 Accesses 51412024348 ops (± 0) 51407870438 ops (± 0) 1.00
commitment_builder_64 L2 Accesses 833960 ops (± 0) 893120 ops (± 0) 0.93
commitment_builder_64 RAM Accesses 192396 ops (± 0) 191298 ops (± 0) 1.01
commitment_builder_64 Estimated Cycles 51422928008 ops (± 0) 51419031468 ops (± 0) 1.00
commitment_builder_128 Instructions 54208831856 ops (± 0) 54204175550 ops (± 0) 1.00
commitment_builder_128 L1 Accesses 68306996181 ops (± 0) 68301951624 ops (± 0) 1.00
commitment_builder_128 L2 Accesses 1296627 ops (± 0) 1258510 ops (± 0) 1.03
commitment_builder_128 RAM Accesses 258234 ops (± 0) 242507 ops (± 0) 1.06
commitment_builder_128 Estimated Cycles 68322517506 ops (± 0) 68316731919 ops (± 0) 1.00
commitment_builder_256 Instructions 31760710558 ops (± 0) 31758548180 ops (± 0) 1.00
commitment_builder_256 L1 Accesses 40835666138 ops (± 0) 40833274463 ops (± 0) 1.00
commitment_builder_256 L2 Accesses 6785821 ops (± 0) 6788005 ops (± 0) 1.00
commitment_builder_256 RAM Accesses 255713 ops (± 0) 239352 ops (± 0) 1.07
commitment_builder_256 Estimated Cycles 40878545198 ops (± 0) 40875591808 ops (± 0) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.