Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Using production instructions in Dockerfile doesn't work #7

Closed
julianwilkinson opened this issue Nov 5, 2019 · 2 comments
Closed
Assignees

Comments

@julianwilkinson
Copy link

Hi,

In the Dockerfile it is instructed to use
RUN npm ci --only=production
instead of
RUN npm install
if we are building for production.

When I do this (API in project_prod.js configured to be a local deployment of the API service) I get the following error:

> bullet-train-frontend@1.3.0 dev /usr/src/app
> cross-env npm run env && node_modules/.bin/nodemon --watch server --ignore server/config/config.json --watch webpack --exec node ./server


> bullet-train-frontend@1.3.0 env /usr/src/app
> node ./bin/env.js

Using project_dev.js
sh: 1: node_modules/.bin/nodemon: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! bullet-train-frontend@1.3.0 dev: `cross-env npm run env && node_modules/.bin/nodemon --watch server --ignore server/config/config.json --watch webpack --exec node ./server`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the bullet-train-frontend@1.3.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-11-05T20_45_49_276Z-debug.log

@julianwilkinson julianwilkinson changed the title Using Production Instructions in Dockerfile doesn't work Using production instructions in Dockerfile doesn't work Nov 5, 2019
@dabeeeenster
Copy link
Contributor

Hi @julianwilkinson. You could use something like this for production:

FROM node:10

# Create app directory
WORKDIR /usr/src/app

# Bundle app source
COPY . .

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

ENV ENV prod
RUN npm i
RUN npm run env
RUN npm run bundle

EXPOSE 8080
CMD [ "npm", "run", "start" ]

@dabeeeenster
Copy link
Contributor

This is in our private upstream repo so will be pushed to github soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants