i want compile source code from github after clone in jenkins, I running jenkins in Docker DIND, but I got problem when I compile with command docker run -v /var/jenkins_home/workspace/nodejs-app:/app -w /app node:alpine npm i i got error
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoen
sample Dockerfile Jenkins
FROM jenkins/jenkins:lts
USER root
RUN apt-get update -qq \
&& apt-get install -qqy apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
RUN apt-get update -qq \
&& apt-get install docker-ce -y
RUN usermod -aG docker jenkins
Sample docker-compose
version: '3'
services:
jenkins:
build: .
container_name: 'jenkins-container'
privileged: true
image: jenkins/jenkins:lts
volumes:
- jenkins_data:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
networks:
- sonarnet
ports:
- '8080:8080'
- '50000:50000'
volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_bundled-plugins:
postgresql:
postgresql_data:
jenkins_data:
if I running in local, it's work, but not work in jenkins
thank you.
