I'm trying to run an Angular app container with this docker file:
# stage 1
FROM node:alpine AS my-app-build
WORKDIR /app
COPY . .
RUN npm install @openapitools/openapi-generator-cli -g
RUN npm run build
# stage 2
FROM nginx:alpine
COPY --from=my-app-build /app/dist/ /usr/share/nginx/html
EXPOSE 80
I need openapitools to generate my client api but I get this error message:
/usr/local/lib/node_modules/@openapitools/openapi-generator-cli/main.js:636
error ? reject(new Error(stderr)) : resolve(stdout);
^
Error: /bin/sh: java: not found
at /usr/local/lib/node_modules/@openapitools/openapi-generator-cli/main.js:636:32
at ChildProcess.exithandler (node:child_process:404:5)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1062:16)
at Socket.<anonymous> (node:internal/child_process:448:11)
at Socket.emit (node:events:390:28)
at Pipe.<anonymous> (node:net:687:12)
Node.js v17.3.1
Error response from daemon: The command '/bin/sh -c npm run build' returned a non-zero code: 1
Why do I need java? Do I have to install it?
Yes you need to install java, or use another openapi generator.
For a angular project I use ng-openapi-gen. This does not need it, and there are probably others.