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

CI: Build linux binaries using ubuntu 20-04 and add vulnerabilities check #1043

Merged
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:

jobs:
build-ubuntu-X64:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
outputs:
eras: ${{ steps.eras-test-lab.outputs.eras }}
steps:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Install stable toolchain, tools, and restore cache
uses: ./.github/workflows/actions/toolchain-and-cache
with:
cache-version: ${{ secrets.CACHE_VERSION }}
cache-version: 20.04-${{ secrets.CACHE_VERSION }}
cargo-tools: cargo-deb

# We separate the build in 2 steps as we want to avoid side effects with Rust feature unification.
Expand Down Expand Up @@ -182,6 +182,9 @@ jobs:
if: success() || failure()
shell: bash
run: cargo sort -w -c

- name: Dependency & Vulnerabilities Review
uses: actions/dependency-review-action@v3

run-test-lab:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mithril-doc",
"version": "0.1.17",
"version": "0.1.18",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down
11 changes: 7 additions & 4 deletions docs/root/compiled-binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ hide_title: true
hide_table_of_contents: true
---

## Download compiled binary
Copy link
Collaborator Author

@Alenar Alenar Jul 11, 2023

Choose a reason for hiding this comment

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

Sadly this title did not show in the sidebars (and it's level wasn't always appropriate) so I had to remove it from this common file to put it manually each time this file is used.

Each Release / Pre-Release distribution comes with pre compiled binaries ready to use or wrapped in a debian package
for linux¹.

Each Release / Pre-Release distribution comes with pre compiled binaries ready to use or wrapped in a debian package.
You can download them from the Release / Pre-Release distribution page that depends on the Mithril Network you
are targeting.

You can download them from the Release / Pre-Release distribution page that depends on the Mithril Network you are targeting.
These links are available in the **Build From** column of the above **Mithril Networks** table.

These links are available in the **Build From** column of the above **Mithril Networks** table.
¹ The Linux binaries target `glibc`, and have a minimum requirement of `glibc 2.31` (compatible with `Ubuntu 20.04`
or `Debian Bullseye`).
4 changes: 2 additions & 2 deletions docs/root/manual/developer-docs/nodes/mithril-aggregator.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ This is the node of the **Mithril Network** responsible for collecting individua

* Install OpenSSL development libraries, for example on Ubuntu/Debian/Mint run `apt install libssl-dev`

* Ensure SQLite3 library is installed on your system and its version is at least `3.40`. Run `sqlite3 --version` to check your version.

## Download source

Download from GitHub (HTTPS)
Expand Down Expand Up @@ -372,6 +370,8 @@ If you want to dig deeper, you can get access to several level of logs from the
:::


## Download pre-built binary

<CompiledBinaries />

## Build and run Docker container
Expand Down
2 changes: 2 additions & 0 deletions docs/root/manual/developer-docs/nodes/mithril-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ If you want to dig deeper, you can get access to several level of logs from the

:::

## Download pre-built binary

<CompiledBinaries />

## Run Docker container
Expand Down
4 changes: 2 additions & 2 deletions docs/root/manual/developer-docs/nodes/mithril-signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ This is the node of the **Mithril Network** responsible for producing individual

* Install OpenSSL development libraries, for example on Ubuntu/Debian/Mint run `apt install libssl-dev`

* Ensure SQLite3 library is installed on your system and its version is at least `3.35` (released Apr. 2021) on Debian/Ubuntu: `apt install libsqlite3` and `sqlite3 --version`.

## Download source

Download from GitHub (HTTPS)
Expand Down Expand Up @@ -170,6 +168,8 @@ If you want to dig deeper, you can get access to several level of logs from the

:::

## Download pre-built binary

<CompiledBinaries />

## Build and run Docker container
Expand Down
2 changes: 2 additions & 0 deletions docs/root/manual/getting-started/bootstrap-cardano-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ If you want to dig deeper, you can get access to several level of logs from the

:::

## Download pre-built binary

<CompiledBinaries />

## Run Docker container
Expand Down
2 changes: 0 additions & 2 deletions docs/root/manual/getting-started/run-mithril-devnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ More information about this private Cardano/Mithril `devnet` is available [here]

* Install OpenSSL development libraries, for example on Ubuntu/Debian/Mint run `apt install libssl-dev`

* Ensure SQLite3 library is installed on your system and its version is at least `3.40`. Run `sqlite3 --version` to check your version.

## Download source

Download from GitHub (HTTPS)
Expand Down
4 changes: 2 additions & 2 deletions docs/root/manual/getting-started/run-signer-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ This guide is working only on a Linux machine.

* Install OpenSSL development libraries, for example on Ubuntu/Debian/Mint run `apt install libssl-dev`

* Ensure the SQLite3 version is at least `3.35` (released Apr. 2021)

* Install a recent version of `jq` (version `1.6+`) `apt install jq`

* Only for the **production** deployment, install a recent version of [`squid-cache`](http://www.squid-cache.org/) (version `5.2+`) `apt install squid`
Expand Down Expand Up @@ -141,6 +139,8 @@ Build executable
make build
```

### Download pre-built binary

<CompiledBinaries />

### Verify binary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ If you want to dig deeper, you can get access to several level of logs from the

:::

## Download pre-built binary

<CompiledBinaries />

## Run Docker container
Expand Down
12 changes: 2 additions & 10 deletions mithril-aggregator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
###############################
# STEP 1: build rust executable
###############################
FROM ubuntu:22.04 AS rustbuilder

# Upgrade and install build base
RUN apt-get update && apt-get install -y libssl-dev curl wget build-essential pkg-config make m4

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo --version
FROM rust:bullseye AS rustbuilder

# Create appuser
RUN adduser --no-create-home --disabled-password appuser
Expand Down Expand Up @@ -37,7 +29,7 @@ RUN /app/target/release/mithril-aggregator --version
###############################
# STEP 2: build a small image
###############################
FROM ubuntu:22.04
FROM debian:11-slim
Copy link
Collaborator

Choose a reason for hiding this comment

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

why isn't the ubuntu-20.04 image used (the same as the CI)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Two reasons:

  • I want to use debian in the dockerfiles as "compatibility test" to check that our ubuntu 20.04 built binaries are compatible with a later version of debian.
  • this allow for the "dev" dockerfiles (the one without the .ci suffix) to use the rust builder images that are debian based, allowing a simplification of the builder step.


# Args
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/8.1.1/cardano-node-8.1.1-linux.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions mithril-aggregator/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Creates a docker image to run an executable built outside of the image
# This relies on the fact the mithril-aggregator executable has been built
# on a debian-compatible x86-64 environment
FROM ubuntu:22.04
FROM debian:11-slim

# Args
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/8.1.1/cardano-node-8.1.1-linux.tar.gz

# Upgrade
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && rm -rf /var/lib/apt/lists/*

# Create appuser
RUN adduser --no-create-home --disabled-password appuser
Expand Down
14 changes: 3 additions & 11 deletions mithril-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
###############################
# STEP 1: build rust executable
###############################
FROM ubuntu:22.04 AS rustbuilder

# Upgrade and install build base
RUN apt-get update && apt-get install -y libssl-dev curl wget build-essential pkg-config make m4

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo --version
FROM rust:bullseye AS rustbuilder

# Create appuser
RUN adduser --no-create-home --disabled-password appuser
Expand Down Expand Up @@ -37,10 +29,10 @@ RUN /app/target/release/mithril-client --version
###############################
# STEP 2: build a small image
###############################
FROM ubuntu:22.04
FROM debian:11-slim

# Upgrade
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*

# Import the user and group files from the builder
COPY --from=rustbuilder /etc/passwd /etc/passwd
Expand Down
4 changes: 2 additions & 2 deletions mithril-client/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Creates a docker image to run an executable built outside of the image
# This relies on the fact the mithril-client executable has been built
# on a debian-compatible x86-64 environment
FROM ubuntu:22.04
FROM debian:11-slim

# Upgrade
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && rm -rf /var/lib/apt/lists/*

# Create appuser
RUN adduser --disabled-password appuser
Expand Down
12 changes: 2 additions & 10 deletions mithril-signer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
###############################
# STEP 1: build rust executable
###############################
FROM ubuntu:22.04 AS rustbuilder

# Upgrade and install build base
RUN apt-get update && apt-get install -y libssl-dev curl wget build-essential pkg-config make m4

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo --version
FROM rust:bullseye AS rustbuilder

# Create appuser
RUN adduser --no-create-home --disabled-password appuser
Expand Down Expand Up @@ -38,7 +30,7 @@ RUN /app/target/release/mithril-signer --version
###############################
# STEP 2: build a small image
###############################
FROM ubuntu:22.04
FROM debian:11-slim

# Args
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/8.1.1/cardano-node-8.1.1-linux.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions mithril-signer/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Creates a docker image to run an executable built outside of the image
# This relies on the fact the mithril-signer executable has been built
# on a debian-compatible x86-64 environment
FROM ubuntu:22.04
FROM debian:11-slim

# Args
ARG CARDANO_BIN_URL=https://github.com/input-output-hk/cardano-node/releases/download/8.1.1/cardano-node-8.1.1-linux.tar.gz

# Upgrade
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget && rm -rf /var/lib/apt/lists/*

# Create appuser
RUN adduser --no-create-home --disabled-password appuser
Expand Down