Skip to content
Merged
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
131 changes: 131 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Dependencies
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Next.js build output
.next
out
build

# Environment files - be specific about what to exclude/include
.env*
!.env.local
!Hedera-OP/my-lz-oapp/.env
# Template files for reference
!env.example.*

# Version control
.git
.gitignore

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

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

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# Temporary folders
tmp/
temp/

# Hardhat/Foundry artifacts (too large for container)
artifacts/
cache/
out/

# Docker files
Dockerfile*
docker-compose*
.dockerignore

# Documentation
*.md
!README.md

# Test files
test/
tests/
*.test.js
*.test.ts
*.spec.js
*.spec.ts

# Coverage reports
coverage/

# Backup files
*.bak
*.backup
103 changes: 103 additions & 0 deletions .github/workflows/docker-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build and Deploy to DockerHub

on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
pull_request:
branches: [ main, master ]

env:
REGISTRY: docker.io
IMAGE_NAME: ethindia

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Update production compose file
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
run: |
# Update the production compose file with the new image
sed -i "s|your-dockerhub-username/ethindia:latest|${{ secrets.DOCKERHUB_USERNAME }}/ethindia:latest|g" docker-compose.production.yml

- name: Create deployment artifact
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
run: |
mkdir -p deployment
cp docker-compose.production.yml deployment/
cp deploy-dockerhub.sh deployment/
cp docker-manage.sh deployment/
cp setup-env.sh deployment/
cp env.example.root deployment/
cp env.example.hedera deployment/

- name: Upload deployment artifact
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: deployment-files
path: deployment/

# Optional: Deploy to a staging environment
deploy-staging:
needs: build-and-push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment: staging

steps:
- name: Download deployment artifact
uses: actions/download-artifact@v3
with:
name: deployment-files

- name: Deploy to staging
run: |
echo "🚀 Deployment to staging would happen here"
echo "Image: ${{ secrets.DOCKERHUB_USERNAME }}/ethindia:latest"
# Add your staging deployment commands here
# For example:
# ssh user@staging-server 'docker pull ${{ secrets.DOCKERHUB_USERNAME }}/ethindia:latest'
# ssh user@staging-server 'docker-compose -f docker-compose.production.yml up -d'
Loading
Loading