backstopmedia / nest-book-example

70 stars 35 forks source link

docker-compose up #27

Closed datajango closed 5 years ago

datajango commented 5 years ago

I'm on Windows 10, the api container errors out.

api_1 | npm ERR! path /app/package.json api_1 | npm ERR! code ENOENT api_1 | npm ERR! errno -2 api_1 | npm ERR! syscall open api_1 | npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json' api_1 | npm ERR! enoent This is related to npm not being able to find a file. api_1 | npm ERR! enoent api_1 | api_1 | npm ERR! A complete log of this run can be found in: api_1 | npm ERR! /root/.npm/_logs/2019-03-09T13_58_48_555Z-debug.log

datajango commented 5 years ago

ok i got it working with some changes to Dockerfile

let me explain: I first mkdir /hame/app, I don;t like putting it in plain /app, sorry. next I set the working directory from now on, its "." next "COPY package.json ." this copies package.json from the folder where docker-compose is running into the working directory which is ".", not "/app" finally: "COPY . ." LOL. Copy everything from from the folder where docker-compose is running into the working directory. Which by the way makes copying "COPY package.json ." redundant.

I'll prove this by doing a ls of /home/app which returns:

bash-4.4# ls /home/app Dockerfile migrate.ts package-lock.json scripts tslint.json artillery migrations package.json src universal client node_modules postman tsconfig.json yarn.lock

datajango commented 5 years ago

hold on.... the last command in the Dockerfile is wrong also CMD ["node", "dist/server.js"] there is no "dist" folder.

adrien2p commented 5 years ago

Hey, glad your found a solution.

If you change the script and don’t target the dist file, that mean you start in dev mode.

If you want to run it like this, you have in fact to run the preprod command and then docker-compose up