Skip to content
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
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Git
.git
.gitignore

# Rust build artifacts
target/
**/*.rs.bk

# IDE
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Docker
Dockerfile*
docker-compose*.yml
.dockerignore
23 changes: 18 additions & 5 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ members = [
"template/runtime",
"precompiles",
"precompiles/macro",
"precompiles/tests-external",
"precompiles/tests-external", "frame/shielding",
]
resolver = "2"

Expand All @@ -55,7 +55,7 @@ derive_more = "1.0"
environmental = { version = "1.1.4", default-features = false }
ethereum = { git = "https://github.com/rust-ethereum/ethereum", rev = "bbb544622208ef6e9890a2dbc224248f6dd13318", default-features = false }
ethereum-types = { version = "0.15", default-features = false }
evm = { git = "https://github.com/rust-ethereum/evm", branch = "v0.x", default-features = false }
evm = { git = "https://github.com/NP-Eng/evm", branch = "v0.x", default-features = false }
futures = "0.3.31"
hash-db = { version = "0.16.0", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
Expand Down Expand Up @@ -204,6 +204,7 @@ pallet-evm-precompile-sha3fips = { path = "frame/evm/precompile/sha3fips", defau
pallet-evm-precompile-simple = { path = "frame/evm/precompile/simple", default-features = false }
pallet-evm-test-vector-support = { path = "frame/evm/test-vector-support" }
pallet-hotfix-sufficients = { path = "frame/hotfix-sufficients", default-features = false }
shielding = { path = "frame/shielding", default-features = false }
# Frontier Utility
precompile-utils = { path = "precompiles", default-features = false }
# Frontier Template
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:1.75-slim

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
clang \
libclang-dev \
libssl-dev \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy source code from frontier directory
COPY . .

# Build the node
RUN cd template/node && cargo build --release --bin frontier-template-node

# Expose ports
EXPOSE 30333 9933 9944 9615

# Run the node
ENTRYPOINT ["/app/template/node/target/release/frontier-template-node"]
CMD ["--dev", "--rpc-cors=all", "--rpc-external", "--rpc-methods=Unsafe", "--rpc-port=9933"]
35 changes: 35 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Development Dockerfile for Frontier Template Node
FROM rust:1.75-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
clang \
libclang-dev \
libssl-dev \
pkg-config \
protobuf-compiler \
curl \
git \
vim \
nano \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy the entire frontier workspace
COPY . .

# Create a non-root user
RUN useradd -m -u 1000 -s /bin/bash substrate && \
chown -R substrate:substrate /app

# Switch to non-root user
USER substrate

# Expose ports
EXPOSE 30333 9933 9944 9615

# Set default command for development
CMD ["bash"]
48 changes: 48 additions & 0 deletions README-Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Docker Setup for Frontier

This directory contains Docker configuration files for running the Frontier template node.

## Quick Start

### Build
```bash
# Build and run the production node
docker compose up --build
```

### Deploy development node
```bash
# Run a development node
docker run -d --name frontier-node -p 9933:9933 -p 9944:9944 frontier-node --dev --rpc-cors=all --rpc-external --rpc-methods=Unsafe --rpc-port 9933
```

## Files

- `Dockerfile` - Production Docker image for the Frontier template node
- `Dockerfile.dev` - Development Docker image with additional tools
- `docker-compose.yml` - Production Docker Compose configuration
- `docker-compose.dev.yml` - Development Docker Compose configuration with hot reloading
- `.dockerignore` - Files to exclude from Docker build context

## Ports

- `30333` - P2P networking
- `9933` - RPC endpoint
- `9944` - WebSocket endpoint
- `9615` - Prometheus metrics
- `9090` - Prometheus (development only)

## Volumes

- `frontier_data` - Persistent chain data (production)
- `frontier_dev_data` - Development build cache
- `cargo_cache` - Rust cargo cache for faster builds

## Development

The development setup includes:
- Hot reloading of source code
- Debug logging enabled
- Interactive bash shell
- Cargo cache for faster builds
- Optional Prometheus monitoring
52 changes: 52 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3.8'

services:
frontier-dev:
build:
context: .
dockerfile: Dockerfile.dev
container_name: frontier-dev
ports:
- "30333:30333" # P2P port
- "9933:9933" # RPC port
- "9944:9944" # WebSocket port
- "9615:9615" # Prometheus metrics
volumes:
- .:/app
- frontier_dev_data:/app/template/node/target
- cargo_cache:/usr/local/cargo
environment:
- RUST_LOG=debug
- RUST_BACKTRACE=1
working_dir: /app/template/node
stdin_open: true
tty: true
command: bash
networks:
- frontier-dev-network

# Optional: Add a simple monitoring service for development
prometheus-dev:
image: prom/prometheus:latest
container_name: frontier-prometheus-dev
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
restart: unless-stopped
networks:
- frontier-dev-network

volumes:
frontier_dev_data:
driver: local
cargo_cache:
driver: local

networks:
frontier-dev-network:
driver: bridge
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
frontier-node:
build: .
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
- "9615:9615"
volumes:
- frontier_data:/app/template/node/target/release/chains
command: ["--dev", "--tmp", "--rpc-external", "--rpc-methods", "unsafe"]

volumes:
frontier_data:
Loading