Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5e6dfee
feat: initial userdata for EC2 and Dockerfile
0xThresh Apr 4, 2025
e77f0dd
fix: Add buildx to userdata, running Dockerfile
0xThresh Apr 6, 2025
93f83e4
Merge branch 'main' into userdata-dockerfile
0xThresh Apr 8, 2025
b665f31
Adding dev dockerfile and removing unnecessary steps
0xThresh Apr 8, 2025
54fd38d
Merge branch 'main' into userdata-dockerfile
0xThresh Jun 17, 2025
56a652a
Add host to compose to enable local access, add example .env file
0xThresh Jun 17, 2025
404fb73
Explicitly copy .sqlx and migrations folder into container build
crypdoughdoteth Jun 17, 2025
3a640a6
Remove module
crypdoughdoteth Jun 17, 2025
1470153
feat: Add Docker build and test actions
0xThresh Jun 18, 2025
dcfc354
fix: Add cargo config and env var for cross compile
0xThresh Jun 18, 2025
2bfcae9
fix: apt install required package for musl
0xThresh Jun 18, 2025
5e8f106
fix: add -y to apt-get
0xThresh Jun 18, 2025
f93794d
fix: Add explicit OpenSSL dependency
0xThresh Jun 18, 2025
64efb88
debug: find where dd_rpc binary ends up
0xThresh Jun 18, 2025
fa07227
debug: check new x86 folder contents
0xThresh Jun 18, 2025
a0b90bf
debug: check release folder
0xThresh Jun 18, 2025
e305044
fix: copy path for new dd_rpc binary
0xThresh Jun 18, 2025
6e08d84
fix: update from scratch to debian image to try to resolve deps issues
0xThresh Jun 18, 2025
548238f
debug: Add rust backtrace to entrypoint
0xThresh Jun 18, 2025
3afa1e8
fix: Rust debug env var
0xThresh Jun 18, 2025
3d7afc2
fix: Rust debug env var
0xThresh Jun 18, 2025
07ca4dd
test: run binary without copying to new layer
0xThresh Jun 18, 2025
48874c6
Fix program init
crypdoughdoteth Jun 18, 2025
4189d0e
ci: remove test job to push imge
0xThresh Jun 22, 2025
b97ee83
ci: add ghcr login and push arg
0xThresh Jun 22, 2025
38bdc0b
fix: push job
0xThresh Jun 22, 2025
d9ded09
fix: image tag
0xThresh Jun 22, 2025
65478b2
fix: capitalization
0xThresh Jun 22, 2025
a751d62
chore: cleanup
0xThresh Jun 22, 2025
10c8f6b
enh: support branch tags, latest tag only on merges to main
0xThresh Jun 23, 2025
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
2 changes: 2 additions & 0 deletions .cargo/.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATABASE_URL=postgres://ddrpcdev:ddrpc123@host.docker.internal:5432/ddrpc
SMTP_USERNAME=test@asdlfknason.com
SMTP_PASSWORD=test!
ETHEREUM_ENDPOINT=http://host.docker.internal:8545
JWT_KEY=<JWT>
43 changes: 43 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: docker-build-test

on:
push:
branches:
- "**"

jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
-
name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Determine Docker tags
id: vars
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "TAGS=ghcr.io/developer-dao/rpc:latest,ghcr.io/developer-dao/rpc:${{ github.sha }}" >> $GITHUB_ENV
else
BRANCH_NAME=$(echo "${{ github.ref }}" | sed 's|refs/heads/||' | tr '/' '-' | tr '[:upper:]' '[:lower:]')
echo "TAGS=ghcr.io/developer-dao/rpc:${BRANCH_NAME}-${{ github.sha }}" >> $GITHUB_ENV
fi
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
load: false
tags: ${{ env.TAGS }}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dotenvy = "0.15.7"
hex = "0.4.3"
jwt-simple = { version = "0.12.7", default-features = false, features = ["pure-rust"] }
lettre = {version = "0.11.4", features = ["rustls-tls"]}
openssl = {version = "0.10.72", features = ["vendored"]}
rand = "0.8.5"
secp256k1 = {version = "0.28.2", features = ["rand", "global-context"]}
serde = {version = "1.0.195", features = ["derive"]}
Expand Down
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app

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

# Build dependencies
RUN apt-get update
RUN apt-get install musl-tools -y
RUN rustup target add x86_64-unknown-linux-musl
ENV CC_x86_64_unknown_linux_musl="x86_64-linux-musl-gcc"
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json

# Build application
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./src ./src
COPY ./.sqlx ./.sqlx
COPY ./migrations ./migrations
RUN apt-get update
RUN apt-get install musl-tools -y
ENV CC_x86_64_unknown_linux_musl="x86_64-linux-musl-gcc"
RUN cargo build --release --target x86_64-unknown-linux-musl

# Test without smaller image
ENV RUST_BACKTRACE="full"

ENTRYPOINT [ "/app/target/x86_64-unknown-linux-musl/release/dd_rpc" ]

# Create a minimal image with the compiled binary
#FROM gcr.io/distroless/static AS runtime
#FROM scratch
# FROM debian:bookworm-slim
# WORKDIR /app
# COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/dd_rpc /app/dd_rpc

#ENTRYPOINT ["/app/dd_rpc"]
18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app

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
# Build dependencies - this is the caching Docker layer!
RUN rustup target add x86_64-unknown-linux-mus
# Build application
COPY . .
#RUN cargo build --release --bin app
RUN cargo install sqlx-cli
RUN cargo build --release

ENTRYPOINT ["cargo", "run", "--release", "--features", "dev"]
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

extra_hosts:
- "host.docker.internal:host-gateway"

volumes:
postgres_data:
3 changes: 0 additions & 3 deletions src/json_rpc/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion src/json_rpc/mod.rs

This file was deleted.

27 changes: 0 additions & 27 deletions src/json_rpc/types.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use tracing_subscriber::fmt::format::FmtSpan;

pub mod database;
pub mod eth_rpc;
pub mod json_rpc;
pub mod middleware;
pub mod routes;

Expand All @@ -46,7 +45,6 @@ static GLOBAL: MiMalloc = MiMalloc;

#[tokio::main]
async fn main() {
dotenv().unwrap();
// PoktChains::init_deployment_url();
JWTKey::init().unwrap();
Database::init().await.unwrap();
Expand Down