Docker compose npm script command not found

607 views Asked by At

I want to make the website with React (NextJS) and connect to MongoDB database. I decided to use docker compose and I got some problem. I can't run yarn run dev command when I run docker-compose up.

Here is my docker-compose.yml

version: '3'

services:
  frontend:
    build: ./frontend
    volumes:
      - ./frontend:/opt/web
    ports:
      - "3000:3000"
  mongodb:
    image: "tutum/mongodb"
    environment:
      - MONGODB_PASS=something
    ports:
      - "27017:27017"
      - "28017:28017"

Here is my Dockerfile (inside frontend folder)

FROM node:alpine

MAINTAINER Chun Rapeepat <[email protected]>

ENV NODE_ENV development
ENV APP /opt/web

RUN mkdir -p $APP
WORKDIR $APP
RUN npm install -g yarn

COPY package.json $APP/
COPY /pages $APP/pages

RUN cd $APP && yarn

CMD ["yarn", "run", "dev"]

When I run docker-compose up command I got message like this

sh: next: not found

What should I fix this, thx.

0

There are 0 answers