Skip to content

Commit

Permalink
feat: docker build and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
kidneyweakx committed Aug 29, 2023
1 parent d16883d commit b2bac9a
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
caddy
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ yarn-error.log*

\*.tsbuildinfo
next-env.d.ts

# docker
dbdata
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:16-alpine3.18

WORKDIR /usr/src/app

COPY . .

RUN npm install

EXPOSE 3000

RUN npm run build

CMD ["npm", "start"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
zk fi
zk fi

```bash
docker-compose up --build -d
curl -X PUT http://admin:passwd@localhost:5984/merkle-tree
```
6 changes: 6 additions & 0 deletions caddy/caddy_config/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
demo.zkafi.com {
reverse_proxy zkafi-frontend:3000 {
flush_interval -1
}
encode zstd gzip
}
Empty file added caddy/caddy_data/.gitkeep
Empty file.
48 changes: 48 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.7'
services:
couchserver:
container_name: zkafi-couchdb
image: couchdb
restart: always
ports:
- "5984:5984"
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=WsonEYErSarDsODisHALigUN
networks:
- zkafi_network
volumes:
- ./dbdata:/opt/couchdb/data

frontend:
container_name: zkafi-frontend
image: zkafi_frontend
ports:
- '3000:3000'
restart: always
networks:
- zkafi_network
- public_access
build:
context: ./
dockerfile: Dockerfile
caddy:
container_name: zkafi-caddy
image: caddy:latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./caddy/caddy_data:/data
- ./caddy/caddy_config:/config
- ./caddy/caddy_config/Caddyfile:/etc/caddy/Caddyfile
networks:
- public_access

networks:
public_access:
zkafi_network:
name: zkafi_network
driver: bridge

2 changes: 1 addition & 1 deletion src/services/merkle-tree.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { invokeFormat } from '../utils/ether-big-number'
const couchdbConfig = {
user: 'admin',
password: 'WsonEYErSarDsODisHALigUN',
host: '35.89.79.195'
host: 'zkafi-couchdb'
}

export async function proofMerkleTree (tree: any, amount: number) {
Expand Down

0 comments on commit b2bac9a

Please sign in to comment.