I have successfully dockerized the AutoScrapeFreeNodes project. Here is a summary of the changes and how to use them.
-
Created
.dockerignore:- Excluded
node_modules,data,.git, etc. to keep the image clean and build fast.
- Excluded
-
Created
Dockerfile:- Base image:
node:18-alpine(lightweight and secure). - Installs production dependencies.
- Exposes port 3000 and 3001.
- Sets up a volume for persistent data storage.
- Base image:
-
Created
docker-compose.yml:- Defines the
autoscrapeservice. - Maps host port 3000 to container port 3000.
- Mounts the
./datadirectory to persist scraped nodes. - Sets the timezone to
Asia/Shanghai.
- Defines the
-
Updated
README.md:- Added a "Docker Deployment" section with clear instructions.
Run the following command in the project root:
docker compose up -dThe application will be available at http://localhost:3000.
Build the image:
docker build -t autoscrape-free-nodes .Run the container:
docker run -d -p 3000:3000 -v $(pwd)/data:/app/data --name autoscrape autoscrape-free-nodes