Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
108 changes: 108 additions & 0 deletions .github/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: build-push

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
tags:
- v*

workflow_dispatch:

jobs:
dummy:
runs-on: ubuntu-latest
steps:
- name: dummy
run: |
echo "Dummy skip step"
egg-standalone-node:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2

- name: Build Image
run: ./scripts/build-standalone-docker.sh

- name: Install docker-slim
run: curl -sL https://raw.githubusercontent.com/docker-slim/docker-slim/master/scripts/install-dockerslim.sh | sudo -E bash -

- name: Slim down the Image
run: docker-slim build --target webb-tools/egg-standalone-node --http-probe-off --entrypoint egg-standalone-node

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/egg-standalone-node

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')

# Use Docker `edge` tag convention
[ "$VERSION" == "main" ] && VERSION=edge

echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag webb-tools/egg-standalone-node.slim $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

egg-parachain-node:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2

- name: Build Image
run: ./scripts/build-parachain-docker.sh

- name: Install docker-slim
run: curl -sL https://raw.githubusercontent.com/docker-slim/docker-slim/master/scripts/install-dockerslim.sh | sudo -E bash -

- name: Slim down the Image
run: docker-slim build --target webb-tools/egg-standalone-node --http-probe-off --entrypoint egg-collator

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/egg-collator

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')

# Use Docker `edge` tag convention
[ "$VERSION" == "main" ] && VERSION=edge

echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag webb-tools/egg-collator.slim $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
16 changes: 8 additions & 8 deletions docker/Parachain.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM rust:buster as builder
WORKDIR /app
WORKDIR /network

RUN rustup default nightly-2021-11-07 && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-07
RUN rustup default nightly-2022-02-01 && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-02-01

# Install Required Packages
RUN apt-get update && apt-get install -y git clang curl libssl-dev llvm libudev-dev libgmp3-dev && rm -rf /var/lib/apt/lists/*
Expand All @@ -13,19 +13,19 @@ ARG BUILD_ARGS

COPY . .
# Build DKG Parachain Node
RUN cargo build --release -p dkg-node
RUN cargo build --release --locked -p egg-collator

# =============

FROM phusion/baseimage:bionic-1.0.0

RUN useradd -m -u 1000 -U -s /bin/sh -d /dkg dkg

COPY --from=builder /app/target/release/dkg-node /usr/local/bin
COPY --from=builder /network/target/release/egg-collator /usr/local/bin

# checks
RUN ldd /usr/local/bin/dkg-node && \
/usr/local/bin/dkg-node --version
RUN ldd /usr/local/bin/egg-collator && \
/usr/local/bin/egg-collator --version

# Shrinking
RUN rm -rf /usr/lib/python* && \
Expand All @@ -39,4 +39,4 @@ RUN chown -R dkg:dkg /dkg/data

VOLUME ["/dkg/data"]

ENTRYPOINT [ "/usr/local/bin/dkg-node" ]
ENTRYPOINT [ "/usr/local/bin/egg-collator" ]
38 changes: 38 additions & 0 deletions docker/Standalone.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM rust:buster as builder
WORKDIR /network

RUN rustup default nightly-2022-02-01 && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-02-01

# Install Required Packages
RUN apt-get update && apt-get install -y git clang curl libssl-dev llvm libudev-dev libgmp3-dev && rm -rf /var/lib/apt/lists/*

ARG GIT_COMMIT=
ENV GIT_COMMIT=$GIT_COMMIT
ARG BUILD_ARGS

COPY . .
# Build Standalone Node.
RUN git submodule update --init && \
cargo build --release --locked -p egg-standalone-node


# ===============

FROM phusion/baseimage:bionic-1.0.0

COPY --from=builder /network/target/release/egg-standalone-node /usr/local/bin

RUN useradd -m -u 1000 -U -s /bin/sh -d /network webb && \
mkdir -p /data /network/.local/share/webb && \
chown -R webb:webb /data && \
ln -s /data /network/.local/share/webb && \
# Sanity checks
ldd /usr/local/bin/egg-standalone-node && \
/usr/local/bin/egg-standalone-node --version

USER webb
EXPOSE 30333 9933 9944 9615 33334
VOLUME ["/data"]

ENTRYPOINT [ "/usr/local/bin/egg-standalone-node"]
14 changes: 14 additions & 0 deletions scripts/build-parachain-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -e

# The following line ensure we run from the project root
PROJECT_ROOT=`git rev-parse --show-toplevel`
cd $PROJECT_ROOT

VERSION=`grep "^version" ./node/Cargo.toml | egrep -o "([0-9\.]+)"`
NODE_NAME=ghcr.io/webb-tools/egg-collator
BUILD_ARGS="cargo build --release -p dkg-node"

docker build -f ./docker/Parachain.Dockerfile . -t $NODE_NAME:$VERSION --build-arg GIT_COMMIT=${VERSION} --build-arg BUILD_ARGS="$BUILD_ARGS"
docker push $NODE_NAME:$VERSION
24 changes: 24 additions & 0 deletions scripts/build-protocol-substrate-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e

pushd .

# The following line ensure we run from the project root
PROJECT_ROOT=`git rev-parse --show-toplevel`
cd $PROJECT_ROOT

# Find the current version from Cargo.toml
VERSION=`grep "^version" ./standalone/node/Cargo.toml | egrep -o "([0-9\.]+)"`
GITUSER=webb-tools
IMAGE_NAME=protocol-substrate-standalone-node

# Build the image
echo "Building ${GITUSER}/${IMAGE_NAME}:latest docker image, hang on!"
time docker build -f ./docker/Standalone.Dockerfile -t ${GITUSER}/${IMAGE_NAME}:latest .
docker tag ${GITUSER}/${IMAGE_NAME}:latest ${GITUSER}/${IMAGE_NAME}:v${VERSION}

# Show the list of available images for this repo
echo "Image is ready"
docker images | grep ${IMAGE_NAME}

popd
24 changes: 24 additions & 0 deletions scripts/build-standalone-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e

pushd .

# The following line ensure we run from the project root
PROJECT_ROOT=`git rev-parse --show-toplevel`
cd $PROJECT_ROOT

# Find the current version from Cargo.toml
VERSION=`grep "^version" ./standalone/node/Cargo.toml | egrep -o "([0-9\.]+)"`
GITUSER=webb-tools
IMAGE_NAME=egg-standalone-node

# Build the image
echo "Building ${GITUSER}/${IMAGE_NAME}:latest docker image, hang on!"
time docker build -f ./docker/Standalone.Dockerfile -t ${GITUSER}/${IMAGE_NAME}:latest .
docker tag ${GITUSER}/${IMAGE_NAME}:latest ${GITUSER}/${IMAGE_NAME}:v${VERSION}

# Show the list of available images for this repo
echo "Image is ready"
docker images | grep ${IMAGE_NAME}

popd