adrianvlupu / C4-Builder

This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
https://adrianvlupu.github.io/C4-Builder/
MIT License
558 stars 91 forks source link

Fails to install on ubuntu (via docker/node) #53

Open luisrayas3 opened 2 years ago

luisrayas3 commented 2 years ago

I tried installing on my local ubuntu machine and when that didn't work (thought it was my version of node/npm) I tried installing in a docker container:

$ docker pull node:16
$ cat c4builder.Dockerfile
FROM node:16
RUN npm i -g c4builder
$ docker build -t c4builder - < c4builder.Dockerfile

This fails:

npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated joi@14.3.1: This module has moved and is now available at @hapi/joi. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/c4builder/node_modules/node-plantuml
npm ERR! command failed
npm ERR! command sh -c node scripts/get-vizjs.js
npm ERR! node:events:498
npm ERR!       throw er; // Unhandled 'error' event
npm ERR!       ^
npm ERR! 
npm ERR! Error: spawn java ENOENT
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR!     at onErrorNT (node:internal/child_process:478:16)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! Emitted 'error' event on ChildProcess instance at:
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR!     at onErrorNT (node:internal/child_process:478:16)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
npm ERR!   errno: -2,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'spawn java',
npm ERR!   path: 'java',
npm ERR!   spawnargs: [
npm ERR!     '-Dplantuml.include.path=/usr/local/lib/node_modules/c4builder/node_modules/node-plantuml',
npm ERR!     '-Djava.awt.headless=true',
npm ERR!     '-jar',
npm ERR!     '/usr/local/lib/node_modules/c4builder/node_modules/node-plantuml/vendor/plantuml.jar',
npm ERR!     '-testdot'
npm ERR!   ]
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-02-28T22_11_43_780Z-debug-0.log
The command '/bin/sh -c npm i -g c4builder' returned a non-zero code: 1

I get the same error using node:alpine or node:17 as the FROM

raikbitters commented 2 years ago

node:16 image doesn't have Java environment. Instead, you can use timbru31/java-node:latest image as a solution.

craigwardman commented 2 years ago

I recently wrote a Dockerfile that can be used to containerize the c4builder tool using a Linux base image.

This has now been merged into the main branch of the c4-builder repo, see: https://github.com/adrianvlupu/C4-Builder/blob/master/Dockerfile

raikbitters commented 2 years ago

@craigwardman could you publish official image on docker hub?

craigwardman commented 2 years ago

it's not an official image, but I have built the Dockerfile (using 0.2.16 version of c4builder) and pushed it to docker hub under my account, so if you want to run it directly you can use:

docker run -v $(pwd):/pwd craigwardman/c4builder