This guide explains how to build and run a Docker container to serve the demo.html file for Extract2MD, including all required assets.
- Docker installed on your system
- Internet connection (to pull the Node.js image and npm packages)
From the project root (where the examples/ folder is located), run:
docker build -t extract2md-demo ./examplesThis will:
- Use the provided
Dockerfilein theexamples/folder - Install
extract2mdandservevia npm - Copy
demo.htmland all required assets into the image
Run the following command to start the server (mapping container port 8080 to your local port 8081):
docker run -p 8081:8080 extract2md-demo- The server will be accessible at http://localhost:8081/demo.html
- Open your browser and go to http://localhost:8081/demo.html
- Upload a PDF and select a scenario to test the Extract2MD conversion features
- If you get a 404 error, make sure you are visiting
/demo.html(not/demoor/). - If you see errors about missing assets, ensure the Docker build completed successfully and that the
distdirectory is present in the container (it should be automatically copied from the npm package). - For WebLLM scenarios, ensure your browser supports WebGPU.
Press Ctrl+C in the terminal where the container is running, or run:
docker ps # Find the container ID
# Then:
docker stop <container_id>For development or advanced usage, you can modify demo.html and rebuild the image to see your changes.