Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce chiseled Docker image #6467

Merged
merged 24 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/nethermind-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ jobs:
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Install Linux packages
run: |
sudo apt-get update
sudo apt-get install libsnappy-dev -y --no-install-recommends
- name: ${{ matrix.project }}
id: test
run: |
Expand Down Expand Up @@ -148,10 +144,6 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Install Linux packages
run: |
sudo apt-get update
sudo apt-get install libsnappy-dev -y --no-install-recommends
- name: ${{ matrix.project }}
id: test
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/posdao-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ jobs:
ref: ${{ matrix.branch }}
submodules: recursive
path: posdao-test-setup
- name: Install Linux packages
run: sudo apt-get update && sudo apt-get install libsnappy-dev
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,18 @@ jobs:
- name: Build and push image to Docker Hub
run: |
image=nethermind/nethermind
docker buildx build --platform=linux/amd64,linux/arm64 -f Dockerfile \
${{ needs.build.outputs.prerelease == 'false' && '-t $image:latest' || '' }} \
-t "$image:${{ github.event.inputs.tag }}" \
--build-arg BUILD_TIMESTAMP=${{ needs.build.outputs.build-timestamp }} \
--build-arg CI=$CI \
--build-arg COMMIT_HASH=$GITHUB_SHA \
. --push

for suffix in "" ".chiseled"; do
if [[ $suffix == ".chiseled" ]]; then tag_suffix="-chiseled"; else tag_suffix=""; fi

docker buildx build --platform=linux/amd64,linux/arm64 -f Dockerfile$suffix \
${{ needs.build.outputs.prerelease == 'false' && '-t $image:latest$tag_suffix' || '' }} \
-t "$image:${{ github.event.inputs.tag }}$tag_suffix" \
--build-arg BUILD_TIMESTAMP=${{ needs.build.outputs.build-timestamp }} \
--build-arg CI=$CI \
--build-arg COMMIT_HASH=$GITHUB_SHA \
. --push
done
- name: Trigger DAppNode build
if: needs.build.outputs.prerelease == 'false'
run: |
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,4 @@ EXPOSE 8545 8551 30303

COPY --from=build /publish .

RUN apt-get update && apt-get -y install libsnappy-dev && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["./nethermind"]
39 changes: 39 additions & 0 deletions Dockerfile.chiseled
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
# SPDX-License-Identifier: LGPL-3.0-only

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build

ARG BUILD_CONFIG=release
ARG BUILD_TIMESTAMP
ARG CI
ARG COMMIT_HASH
ARG TARGETARCH

COPY .git .git
COPY src/Nethermind src/Nethermind

RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
dotnet publish src/Nethermind/Nethermind.Runner -c $BUILD_CONFIG -a $arch -o /publish --sc false \
-p:BuildTimestamp=$BUILD_TIMESTAMP -p:Commit=$COMMIT_HASH

# Creating these directiories here is needed to ensure the correct permissions
RUN cd /publish && \
mkdir keystore && \
mkdir logs && \
mkdir nethermind_db

FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled

WORKDIR /nethermind

VOLUME /nethermind/keystore
VOLUME /nethermind/logs
VOLUME /nethermind/nethermind_db

EXPOSE 8545 8551 30303

COPY --from=build --chown=app /publish .

USER app

ENTRYPOINT ["./nethermind"]
3 changes: 0 additions & 3 deletions Dockerfile.diag
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,4 @@ COPY --from=build /tmp/jetbrains.dotmemory.console.*/**/tools /opt/diag-tools/do

ENV PATH="$PATH:/opt/diag-tools:/opt/diag-tools/dotmemory"

RUN apt-get update && apt-get -y install libsnappy-dev && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["./nethermind"]
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ Release builds are available on the [Releases page](https://github.com/nethermin

### On Linux

#### Prerequisites

- #### Ubuntu / Debian

```sh
sudo apt-get install libsnappy-dev
```

- #### CentOS / Fedora

```sh
sudo dnf install -y snappy
sudo ln -s `find /usr/lib64/ -type f -name "libbz2.so.1*"` /usr/lib64/libbz2.so.1.0
```

#### Install using PPA

1. `sudo add-apt-repository ppa:nethermindeth/nethermind` \
Expand Down Expand Up @@ -93,7 +78,7 @@ The output should show the image digest, and then you can copy that to the `FROM

### Prerequisites

Install [.NET SDK](https://dotnet.microsoft.com/en-us/download)
Install [.NET SDK](https://dotnet.microsoft.com/en-us/download).

### Clone the repository

Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/ppa/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Rules-Requires-Root: no

Package: nethermind
Architecture: amd64 arm64
Depends: ${misc:Depends}, ${shlibs:Depends}, libsnappy-dev
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: A robust execution client for Ethereum node operators.
Nethermind is a high-performance, highly configurable Ethereum execution client built on .NET that runs on Linux, Windows, and macOS and supports Clique, Aura, and Ethash. With breakneck sync speeds and support for external plugins, it provides reliable access to rich on-chain data thanks to a high-performance JSON-RPC interface and node health monitoring with Grafana and Seq.
2 changes: 2 additions & 0 deletions scripts/deployment/ppa/debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ case "$1" in
;;

remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
rm -f /usr/bin/nethermind

if [[ -d /usr/share/nethermind ]]; then
cd /usr/share/nethermind

Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<PackageVersion Include="RocksDB" Version="8.10.0.45817" />
<PackageVersion Include="SCrypt" Version="2.0.0.2" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="Snappy.Standard" Version="0.2.0" />
<PackageVersion Include="Snappier" Version="1.1.3" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
<PackageVersion Include="System.IO.Pipelines" Version="8.0.0" />
Expand Down
5 changes: 1 addition & 4 deletions src/Nethermind/Nethermind.Db.Rocks/DbOnTheRocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ private RocksDb Init(string basePath, string dbPath, IDbConfig dbConfig, ILogMan
}
catch (DllNotFoundException e) when (e.Message.Contains("libdl"))
{
throw new ApplicationException(
$"Unable to load 'libdl' necessary to init the RocksDB database. Please run{Environment.NewLine}" +
$"sudo apt-get update && sudo apt-get install libsnappy-dev libc6-dev libc6 unzip{Environment.NewLine}" +
"or similar depending on your distribution.");
throw;
}
catch (RocksDbException x) when (x.Message.Contains("LOCK"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Crc32.NET" />
<PackageReference Include="Nethermind.DotNetty.Handlers" />
<PackageReference Include="Snappy.Standard" />
<PackageReference Include="Snappier" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Swarm\**" />
Expand Down
Loading