Skip to content

Commit

Permalink
Add docker file for continuum
Browse files Browse the repository at this point in the history
  • Loading branch information
justinphamnz committed Aug 1, 2023
1 parent aba5f63 commit 79b93b9
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
41 changes: 40 additions & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,43 @@ jobs:
build-args: |
GIT_COMMIT=${{ env.GIT_VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
run: echo ${{ steps.docker_build.outputs.digest }}
continuum:
runs-on: ubuntu-latest
environment:
name: continuum

if: ${{ github.event.inputs.runtime == 'pioneer' }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to Container Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
gitversion=$(git rev-parse --short HEAD)
echo "running on $gitversion"
echo "GIT_VERSION=$gitversion" >> $GITHUB_ENV
shell: bash

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
file: "scripts/${{ secrets.DOCKERFILE }}"
tags: |
${{ env.REGISTRY }}/${{ secrets.REGISTRY_ENDPOINT }}:latest
${{ env.REGISTRY }}/${{ secrets.REGISTRY_ENDPOINT }}:${{ env.GIT_VERSION }}
build-args: |
GIT_COMMIT=${{ env.GIT_VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
47 changes: 47 additions & 0 deletions scripts/Dockerfile_continuum
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM rust:buster as builder
WORKDIR /app

RUN rustup default nightly-2022-11-15 && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-11-15

RUN apt-get update && \
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y cmake pkg-config libssl-dev git clang libclang-dev protobuf-compiler


ARG GIT_COMMIT=
ENV GIT_COMMIT=$GIT_COMMIT
ARG BUILD_ARGS
ARG PROFILE=release

COPY . .

RUN cargo build --release --features=with-continuum-runtime

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

FROM phusion/baseimage:focal-1.2.0
LABEL maintainer="[email protected]"

ARG PROFILE

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

COPY --from=builder /app/target/release/metaverse-node /usr/local/bin

# checks
RUN ldd /usr/local/bin/metaverse-node && \
/usr/local/bin/metaverse-node --version

# Shrinking
RUN rm -rf /usr/lib/python* && \
rm -rf /usr/sbin /usr/share/man

USER metaverse
EXPOSE 30333 9933 9944

RUN mkdir /metaverse/data

VOLUME ["/metaverse/data"]

ENTRYPOINT ["/usr/local/bin/metaverse-node"]
10 changes: 10 additions & 0 deletions scripts/docker_build_continuum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

VERSION=$(git rev-parse --short HEAD)

echo $VERSION

docker build -f scripts/Dockerfile_continuum . -t bitcountry/continuum-parachain-node:$VERSION --no-cache --build-arg GIT_COMMIT=${VERSION}
docker push bitcountry/continuum-parachain-node:$VERSION

0 comments on commit 79b93b9

Please sign in to comment.