-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce cross for cross-platform docker image
- Loading branch information
Showing
15 changed files
with
149 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,77 +3,75 @@ on: | |
branches: | ||
- main | ||
|
||
name: Create and publish a Docker image | ||
name: docker | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build_and_push_docker_image: | ||
build: | ||
name: build and push docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
contents: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# github action worker got about 14GB available space for building which is not enough | ||
# remove some unused binary in the image to get more spaces | ||
- name: Make more space to compilation | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Rust toolchain | ||
uses: dtolnay/[email protected] | ||
|
||
- name: Setup Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
|
||
- uses: taiki-e/install-action@cross | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get Git Tag | ||
run: echo "tags=$(git describe --tags)" >> $GITHUB_OUTPUT | ||
id: tag | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Fetch third-party dependencies | ||
run: | | ||
make fetch-thirdparty | ||
- name: Setup Yarn cache - submodule "thirdparty/account-abstraction" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.17' | ||
cache: 'yarn' | ||
cache-dependency-path: crates/contracts/thirdparty/account-abstraction | ||
|
||
- name: Setup Yarn cache - submodule "thirdparty/bundler" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.17' | ||
cache: 'yarn' | ||
cache-dependency-path: tests/thirdparty/bundler | ||
|
||
- name: Setup third-party dependencies | ||
run: | | ||
make setup-thirdparty | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
- name: Install solc | ||
run: .github/scripts/install_solc.sh | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
provenance: false | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Set up Docker builder | ||
run: | | ||
docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64 | ||
docker buildx create --use --name cross-builder | ||
- name: Build and push Silius image | ||
run: make docker-build-push |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ authors = ["Vid Kersic <[email protected]>"] | |
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/silius-rs/silius" | ||
rust-version = "1.76.0" | ||
rust-version = "1.78.0" | ||
keywords = [ | ||
"silius", | ||
"primitives", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[build] | ||
pre-build = [ | ||
"apt-get update && apt-get -y upgrade && apt-get install -y wget pkg-config llvm-dev libclang-6.0-dev clang-6.0 libssl-dev", | ||
"wget -c https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux && mv solc-static-linux /usr/local/bin/solc && chmod a+x /usr/local/bin/solc" | ||
] | ||
|
||
[build.env] | ||
passthrough = [ | ||
"JEMALLOC_SYS_WITH_LG_PAGE", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM --platform=$TARGETPLATFORM ubuntu:22.04 | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/silius-rs/silius | ||
LABEL org.opencontainers.image.description="Silius - ERC-4337 (Account Abstraction) bundler implementation in Rust." | ||
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0" | ||
|
||
ARG TARGETARCH | ||
|
||
COPY ./dist/bin/$TARGETARCH/silius /usr/local/bin/silius | ||
|
||
EXPOSE 3000 3001 | ||
|
||
ENTRYPOINT ["/usr/local/bin/silius"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.