When you are unable or unwilling to directly install @blocklet/cli on the computer for some reason, it can be difficult to develop Blocklet
because @blocklet/cli is an essential tool for developing or running Blocklet
The following will introduce how to develop a blocklet on a computer without installing @blocklet/cli , but through Docker
- Install Docker
Please refer to the Docker Official tutorial, or other Docker installation tutorials to complete the installation
- Prepare the docker-compose.yaml file
services:
blocklet-server:
container_name: blocklet-server-docker
image: arcblock/blocklet-server-dev
ports:
- 80:80
- 443:443
volumes:
- ./data:/data # Store blocklet-server data on ./data folder
- ./code:/workspace/app # Store blocklet code on ./code folder
- node_modules:/workspace/app/node_modules # Don't mount node_modules folder
# - pnpm-store: /workspace/app/.pnpm-store # If you are using pnpm to install deps, you would better to add this config
environment:
ABT_NODE_HOST: 192.168.1.111 # Your host IP- Start the container using
docker compose up -d - Enter the container using the
docker compose exec --workdir=/workspace/app blocklet-server /bin/bashcommand - Perform
blocklet create ./, choose the template you want to create, and follow the prompts to complete the project creation - Install dependencies
npm ioryarnorpnpm i - Execute
blocklet dev - The program will start up and print an accessible address
- Clicking on the address will let you access the current blocklet normally