I wrote an deploy script in node to deploy my java fatJar compiled using gradle to an serverless service platform.
My main image selected is java, so I have to either create an custom image or apt-get install nodejs at build time, since I’m not familiar to docker so I’ve choice apt-get install solution. But I’m unable to run npm or node command, it keeps failing with message: npm: No such file or directory
, even if I try to access it directly though /usr/bin/npm
, it still isn’t working and system is unable to find npm executable… Can anyone help…? orz
My circle-ci config file:
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx1000m
TERM: dumb
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}-{{ checksum "deploy/package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: gradle dependencies
- run: sudo apt-get install nodejs
- run:
command: /usr/bin/npm i
working_directory: deploy
- save_cache:
paths:
- ~/.gradle
- ~/deploy/node_modules
key: v1-dependencies-{{ checksum "build.gradle" }}
- run: gradle fatJar
- run:
command: npm run run
working_directory: deploy