Reputation: 1536
So the situation is that I have coupled a bash script with docker. I use bash script to pull my code from the remote repo, and then execute the docker-compose
Here's my dockerfile
FROM node:6
WORKDIR /home/ayush/project-folder
RUN pwd
RUN npm run build
CMD ["forever", "server/app.js"]
Here's the section of my docker-compose.yml
that has the above service listed:
web:
build: ./client
environment:
- NODE_VERSION=$NODE_WEB_VERSION
ports:
- "4200:4200"
api:
And here's my simple bash script
#!/usr/bin/env bash
frontend=$1
backend=$2
git clone //remote_url --branch $frontend --single-branch
mv project-folder ~/
docker-compose up
But the issue is that the RUN npm run build gives error
,
enoent ENOENT: no such file or directory, open '/home/ayush/project-folder/package.json'
What could be the issue?
Upvotes: 0
Views: 175
Reputation: 81
You forgot to copy your project during build time, with
...
COPY . ./
RUN npm run build
...
This will copy the whole build context (the contents of ./client
) to the working directory, which you've set to /home/ayush/project-folder
in the previous statement.
Upvotes: 2