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

feat: add ci docker build for trin-execution #1586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
41 changes: 41 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,37 @@ jobs:
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push $IMAGE_NAME:latest-bridge
docker-build-execution:
resource_class: xlarge
executor: docker-publisher
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker execution image
no_output_timeout: 30m
command: docker build -f ./trin-execution/Dockerfile -t $IMAGE_NAME:latest-execution --build-arg GIT_HASH=$CIRCLE_SHA1 .
- run:
name: Archive Docker image
command: docker save -o execution-image.tar $IMAGE_NAME
- persist_to_workspace:
root: .
paths:
- ./execution-image.tar
docker-publish-execution:
executor: docker-publisher
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load archived Docker image
command: docker load -i /tmp/workspace/execution-image.tar
- run:
name: Publish docker image to Docker Hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push $IMAGE_NAME:latest-execution
cargo-fmt:
description: |
Check linting with rustfmt.
Expand Down Expand Up @@ -324,6 +355,16 @@ workflows:
filters:
branches:
only: master
- docker-build-execution:
filters:
branches:
only: master
- docker-publish-execution:
requires:
- docker-build-execution
filters:
branches:
only: master
- cargo-fmt
- cargo-clippy
- build
Expand Down
48 changes: 48 additions & 0 deletions trin-execution/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# select build image
FROM rust:1.81.0 AS builder

# create a new empty shell project
RUN USER=root cargo new --bin trin-execution
WORKDIR /trin

# Docker build command *SHOULD* include --build-arg GIT_HASH=...
# eg. --build-arg GIT_HASH=$(git rev-parse HEAD)
ARG GIT_HASH=unknown
ENV GIT_HASH=$GIT_HASH

RUN apt-get update && apt-get install clang -y

# copy over manifests and source to build image
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./e2store ./e2store
COPY ./ethportal-api ./ethportal-api
COPY ./ethportal-peertest ./ethportal-peertest
COPY ./light-client ./light-client
COPY ./portalnet ./portalnet
COPY ./portal-bridge ./portal-bridge
COPY ./rpc ./rpc
COPY ./src ./src
COPY ./trin-beacon ./trin-beacon
COPY ./trin-evm ./trin-evm
COPY ./trin-execution ./trin-execution
COPY ./trin-history ./trin-history
COPY ./trin-metrics ./trin-metrics
COPY ./trin-state ./trin-state
COPY ./trin-storage ./trin-storage
COPY ./trin-utils ./trin-utils
COPY ./trin-validation ./trin-validation
COPY ./utp-testing ./utp-testing

# build for release
RUN cargo build -p trin-execution --release

# final base
FROM ubuntu:22.04

# copy build artifacts from build stage
COPY --from=builder /trin/target/release/trin-execution /usr/bin/

ENV RUST_LOG=debug

ENTRYPOINT ["/usr/bin/trin-execution"]
Loading