Skip to content

Commit

Permalink
Merge pull request #140 from IronJam11/main
Browse files Browse the repository at this point in the history
Add Docker Support for Simplified Setup and Deployment
  • Loading branch information
Ronnieraj37 authored Feb 24, 2025
2 parents 6e314a1 + 17311b5 commit 177c1fd
Show file tree
Hide file tree
Showing 8 changed files with 11,019 additions and 6,357 deletions.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,42 @@ Here's a refined version of the development guide:
```bash
git clone https://github.com/AOSSIE-Org/Agora-Blockchain
```
### Option 1: Docker Setup

## Backend
1. **Clone the Repository**:
```bash
git clone https://github.com/AOSSIE-Org/Agora-Blockchain
cd Agora-Blockchain
```

2. **Set up Environment Variables**:

Create `.env.local` in the `blockchain` directory:
```
PRIVATE_KEY=<your_private_key>
RPC_URL_SEPOLIA=<your_sepolia_rpc_url>
RPC_URL_FUJI=<your_fuji_rpc_url>
ETHERSCAN_KEY=<your_etherscan_api_key>
```

Create `.env.local` in the `client` directory:
```
NEXT_PUBLIC_PINATA_JWT=<your_pinata_jwt>
```

3. **Run with Docker Compose**:
```bash
docker-compose up --build
```

4. **Access the Application**:
- Frontend: http://localhost:3000
- Blockchain Node: http://localhost:8545

The application will automatically reload when you make changes to the source code.

### Option 2: Manual Setup
## Backend
1. **Navigate to the Blockchain Directory**:

```bash
Expand Down
50 changes: 50 additions & 0 deletions blockchain/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Dependencies
node_modules
npm-debug.log
yarn-debug.log
yarn-error.log

# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Hardhat files
cache
artifacts
typechain-types

# Version control
.git
.gitignore

# IDE specific files
.idea
.vscode
*.swp
*.swo

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Testing
coverage
coverage.json
.nyc_output

# Debug logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build files
dist
build
20 changes: 20 additions & 0 deletions blockchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:20-slim

WORKDIR /app/blockchain

# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Set Python path for node-gyp
ENV PYTHON=/usr/bin/python3

COPY package*.json ./
RUN npm install

COPY . .

CMD ["npx", "hardhat", "node"]
50 changes: 50 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Dependencies
node_modules
npm-debug.log
yarn-debug.log
yarn-error.log

# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Hardhat files
cache
artifacts
typechain-types

# Version control
.git
.gitignore

# IDE specific files
.idea
.vscode
*.swp
*.swo

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Testing
coverage
coverage.json
.nyc_output

# Debug logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build files
dist
build
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
.env
26 changes: 26 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:20-slim

WORKDIR /app/client

# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Set Python path for node-gyp
ENV PYTHON=/usr/bin/python3

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000

# Use 0.0.0.0 to allow external connections
ENV HOST=0.0.0.0
ENV PORT=3000

CMD ["npm", "run", "dev"]
Loading

0 comments on commit 177c1fd

Please sign in to comment.