Skip to content

Commit

Permalink
improve docker images, improve ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Feb 11, 2025
1 parent 8cf33b8 commit 5e6c476
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ permissions:
attestations: write
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-masp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
paths:
- 'masp-indexer/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-namada.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-workload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
paths:
- 'workload/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write
Expand Down
6 changes: 0 additions & 6 deletions check/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Stage 1: Prepare the build environment
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS chef
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

# Stage 2: Cache dependencies
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS cacher
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
libprotobuf-dev \
Expand All @@ -20,23 +18,19 @@ WORKDIR /app
COPY --from=chef /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

# Stage 3: Build the application
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS builder
WORKDIR /app
COPY . .
COPY --from=cacher /app/target target
RUN cargo build --release --locked

# Stage 4: Create the final image
FROM docker.io/debian:bookworm-slim
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y ca-certificates curl build-essential && apt-get clean
WORKDIR /app

# Copy the runtime files
COPY --from=builder /app/target/release/namada-chain-check /app/namada-chain-check
COPY --chmod=0755 docker_run.sh /app/run.sh

# Download masp parameters
RUN curl -o /app/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true \
&& curl -o /app/masp-output.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true \
&& curl -o /app/masp-convert.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true
Expand Down
22 changes: 16 additions & 6 deletions genesis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ FROM docker.io/rust:1.81-slim-bullseye as builder
# Pinning a commit
ARG GIT_SHA
ARG GENESIS_TEMPLATE_VERSION
ARG PROFILE="release"

# problem with libclang-12-dev, also added curl
RUN apt-get -y update
RUN apt-get install -y make git-core libssl-dev pkg-config libclang-13-dev build-essential protobuf-compiler libudev-dev curl wget python3 python3-pip wget
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
make \
git-core \
libssl-dev \
pkg-config \
libclang-13-dev \
build-essential \
protobuf-compiler \
libudev-dev \
curl \
wget \
python3 \
python3-pip && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install toml

RUN git clone https://github.com/anoma/namada.git /namada && cd /namada && git checkout $GIT_SHA
ADD --keep-git-dir=true https://github.com/anoma/namada.git#$GIT_SHA .

# Important!
WORKDIR /namada
Expand All @@ -32,7 +43,6 @@ RUN mkdir -p /validator-1
RUN mkdir -p /validator-2

RUN cargo install wasm-opt --locked

RUN make build-wasm-scripts

# Preparing the network templates for starting the chain
Expand Down
1 change: 1 addition & 0 deletions masp-indexer/block-filter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
wget \
postgresql \
curl \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -o /app/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true \
Expand Down
1 change: 1 addition & 0 deletions masp-indexer/chain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
wget \
postgresql \
curl \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -o /app/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true \
Expand Down
1 change: 1 addition & 0 deletions masp-indexer/webserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
wget \
postgresql \
curl \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -o /app/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true \
Expand Down
1 change: 1 addition & 0 deletions namada/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
libudev-dev \
curl \
wget \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ADD --keep-git-dir=true https://github.com/anoma/namada.git#$GIT_SHA .
Expand Down
12 changes: 5 additions & 7 deletions workload/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Stage 1: Prepare the build environment
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS chef
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

# Stage 2: Cache dependencies
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS cacher
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
libprotobuf-dev \
Expand All @@ -20,26 +18,26 @@ WORKDIR /app
COPY --from=chef /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

# Stage 3: Build the application
FROM lukemathwalker/cargo-chef:latest-rust-1.81 AS builder
WORKDIR /app
COPY . .
COPY --from=cacher /app/target target
RUN cargo build --release --locked

# Stage 4: Create the final image
FROM docker.io/debian:bookworm-slim
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y ca-certificates curl build-essential && apt-get clean
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
ca-certificates \
curl \
build-essential \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app

# Copy the runtime files
COPY --from=builder /app/target/release/namada-chain-workload /app/namada-chain-workload
COPY --from=builder /app/docker_run.sh /app/run.sh
COPY --from=builder /app/scripts/ /opt/antithesis/test/v1/namada/

RUN chmod +x /app/run.sh && chmod -R +x /opt/antithesis/test/v1/namada/

# Download masp parameters
RUN curl -o /app/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true \
&& curl -o /app/masp-output.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true \
&& curl -o /app/masp-convert.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true
Expand Down

0 comments on commit 5e6c476

Please sign in to comment.