Skip to content

Commit

Permalink
simplify docker and fix bench-check cache
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed Sep 15, 2023
1 parent 0bfbf7a commit 9fddac4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/sanity-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ jobs:
matrix:
target: [test-general, test-integration,
lint-fmt, lint-clippy, cargo-build] # ,lint-taplo]
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
RUSTC_WRAPPER: "sccache"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2

- name: Prep build
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }}
RUST_TOOLCHAIN: "nightly-2022-11-14"
cache: enabled
# Cache needs Google credentials:
GWIP: ${{ secrets.GWIP_SCCACHE }}
Expand All @@ -40,23 +37,22 @@ jobs:
run: ./ci/run-check.sh
env:
TARGET: ${{ matrix.target }}
RUSTC_WRAPPER: "sccache"

benchmark-check:
name: bench-check-${{ matrix.runtime }}
runs-on: ubuntu-latest #r-4-cores
strategy:
matrix:
runtime: [development, altair, centrifuge]
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2

- name: Prep build
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }}
RUST_TOOLCHAIN: "nightly-2022-11-14"
setup_cache: true
cache: enabled
GWIP: ${{ secrets.GWIP_SCCACHE }}
Expand All @@ -67,3 +63,4 @@ jobs:
env:
TARGET: benchmark-check
RUNTIME: ${{ matrix.runtime }}
RUSTC_WRAPPER: "sccache"
25 changes: 15 additions & 10 deletions docker/centrifuge-chain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ FROM docker.io/library/ubuntu:22.04 as builder
COPY . centrifuge-chain
WORKDIR /centrifuge-chain
RUN echo $(ls -l /centrifuge-chain/)

RUN \
rustup-init -y --profile minimal --default-toolchain stable; \
cargo install sccache;

RUN rustup default $RUST_TOOLCHAIN && \
rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN && \
cargo build "--release" --features=${FEATURES}
rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN

# RUN cargo build "--release" --features=${FEATURES}

# ===== SECOND STAGE ======
# ToDo: create a secure image as a base for the binary
Expand All @@ -59,14 +63,15 @@ FROM docker.io/library/ubuntu:22.04
RUN ldd /usr/local/bin/centrifuge-chain && \
/usr/local/bin/centrifuge-chain --version

# Unclutter
RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/ && \
mkdir -p /root/.local/share/centrifuge-chain && \
ln -s /root/.local/share/centrifuge-chain /data
# minimize the attack surface
# Unclutter
# RUN mv /usr/share/ca* /tmp && \
# rm -rf /usr/share/* && \
# mv /tmp/ca-certificates /usr/share/
# minimize the attack surface
# rm -rf /usr/bin /usr/sbin /usr/lib/python* && \
RUN mkdir -p /root/.local/share/centrifuge-chain && \
ln -s /root/.local/share/centrifuge-chain /data



USER centrifuge
Expand Down

0 comments on commit 9fddac4

Please sign in to comment.