-
Notifications
You must be signed in to change notification settings - Fork 39
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
chore: update docker build, ci #270
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
# Generated by Cargo, executables | ||
target | ||
|
||
# GitHub workflows/actions | ||
.github | ||
|
||
# Folder containing files for bundler spec tests | ||
bundler-spec-tests | ||
|
||
# Documentation | ||
docs | ||
|
||
# Dockerfile | ||
Dockerfile | ||
# Scripts | ||
scripts | ||
|
||
# Folder containing files for bundler spec tests | ||
bundler-spec-tests | ||
# Generated by Cargo, executables | ||
target | ||
|
||
# Third party dependencies | ||
crates/contracts/thirdparty/account-abstraction/* | ||
tests/thirdparty/bundler/* | ||
# Other files | ||
.gitignore | ||
CODEOWNERS | ||
CONTRIBUTING.md | ||
docker-compose.yml | ||
Dockerfile | ||
rustfmt.toml | ||
tomlfmt.toml |
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
# install geth | ||
|
||
GETH_VERSION="1.12.0-e501b3b0" | ||
|
||
wget -c "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-$GETH_VERSION.tar.gz" | ||
tar -xf "geth-linux-amd64-$GETH_VERSION.tar.gz" | ||
mv geth-linux-amd64-$GETH_VERSION/geth /usr/local/bin/ | ||
chmod a+x /usr/local/bin/geth | ||
|
||
geth version |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
# install solc | ||
|
||
SOLC_VERSION="v0.8.20" | ||
|
||
wget -c "https://github.com/ethereum/solidity/releases/download/$SOLC_VERSION/solc-static-linux" | ||
mv solc-static-linux /usr/local/bin/solc | ||
chmod a+x /usr/local/bin/solc | ||
|
||
solc --version |
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 |
---|---|---|
@@ -1,40 +1,55 @@ | ||
# build | ||
FROM ubuntu:18.04 AS builder | ||
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef | ||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get -y upgrade && apt-get install -y build-essential software-properties-common ca-certificates curl gnupg git clang pkg-config libclang-dev libssl-dev | ||
RUN add-apt-repository ppa:ethereum/ethereum && apt-get update && apt-get install -y solc | ||
LABEL org.opencontainers.image.source=https://github.com/silius-rs/silius | ||
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0" | ||
|
||
# build cargo-chef plan | ||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
|
||
RUN mkdir -p /etc/apt/keyrings | ||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list | ||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
# Set the build profile to be release | ||
ARG BUILD_PROFILE=release | ||
ENV BUILD_PROFILE $BUILD_PROFILE | ||
|
||
RUN apt-get update && apt-get install -y nodejs yarn | ||
# Install system dependencies | ||
RUN apt-get update && apt-get -y upgrade && apt-get install -y pkg-config libclang-dev libssl-dev | ||
|
||
WORKDIR /rust | ||
# Install solc | ||
RUN wget -c "https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux" | ||
RUN mv solc-static-linux /usr/local/bin/solc | ||
RUN chmod a+x /usr/local/bin/solc | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH="/root/.cargo/bin:$PATH" | ||
# Builds dependencies | ||
RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json | ||
|
||
WORKDIR /silius | ||
# Build application | ||
COPY . . | ||
RUN cargo build --profile $BUILD_PROFILE --locked | ||
|
||
RUN make fetch-thirdparty | ||
RUN make setup-thirdparty | ||
RUN make build | ||
# Copy application | ||
RUN cp /app/target/$BUILD_PROFILE/silius /app/silius | ||
|
||
# run | ||
FROM frolvlad/alpine-glibc:alpine-3.17 | ||
# Use alpine as a runtime image | ||
FROM frolvlad/alpine-glibc:alpine-3.17 AS runtime | ||
|
||
# Create data folder | ||
RUN mkdir -p /data/silius | ||
|
||
# Install system dependencies | ||
RUN apk add openssl1.1-compat | ||
|
||
COPY --from=builder /silius/target/release/silius /usr/local/bin/silius | ||
# Copy silus binary | ||
COPY --from=builder /app/silius /usr/local/bin/silius | ||
|
||
# Copy licenses | ||
COPY LICENSE-* ./ | ||
|
||
# Expose ports | ||
EXPOSE 3000 3001 | ||
|
||
ENTRYPOINT ["/usr/local/bin/silius"] | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/silius-rs/silius |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could build "locally" and just copy the target into the image. In this case, docker image is much smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. But I would keep the building inside Docker so someone who can't build Silius locally (due to unsupported architecture) can build it in Docker.