mercredi 8 novembre 2017

Docker NPM Issue - node_modules appears empty

I am using this as my docker

        # 1: Use node 6.4.0 as base:
        FROM node:6.4.0

        # 2: We'll set the application path as the working directory
        WORKDIR /usr/src/web-client

        # 3: We'll add the app's binaries path to $PATH:
        ENV PATH=/usr/src/web-client/bin:$PATH

        ADD package.json /tmp/package.json
        RUN cd /tmp && npm install
        RUN mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/

        # 4: Install ember-cli and friends:
        RUN set -ex \
          && npm install -g ember-cli \
          && npm install -g bower \
          && npm install -g phantomjs-prebuilt \
          && npm install -g check-dependencies

        # 5: Install watchman:
        RUN set -ex \
          && export WATCHMAN_VERSION=4.6.0 \
          && curl -SL "http://ift.tt/2zuikIX" | tar -xz -C /tmp/ \
          && cd /tmp/watchman-${WATCHMAN_VERSION} \
          && ./autogen.sh \
          && ./configure \
          && apt-get update && apt-get install -y --no-install-recommends python-dev \
          && make \
          && make install \
          && apt-get purge -y --auto-remove python-dev \
          && rm -rf /var/lib/apt/lists/* \
          && rm -rf /tmp/*

        # 6: Expose the app and live-reload ports:
        EXPOSE 4200 35730

        # 7: Set the default command:
        CMD ["ember", "server", "--live-reload-port", "35730"]

and this as my docker compose file

version: '2'

services: web: image: selleo/ember-cli:2.7.0 build: context: . dockerfile: Dockerfile command: ember server --live-reload-port 35730

volumes:
  # Mount the app code inside the container's `/usr/src/app` directory:
  - .:/usr/src/web-client

# Keep the stdin open, so we can attach to our app container's process
# and do things such as debugging, etc:
stdin_open: true

# Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
tty: true

ports:
  # Bind the host's 4200 port to the container's ember app server
  # port 4200:
  - 4200:4200
  # Bind the host's 35730 port to the container's ember cli live reload
  # server port 35730:
  - 35730:35730
volumes:
    - ./src:/var/www/html
    - /var/www/html/node_modules

and I am getting this error: node_modules appears empty, you may need to run npm install when I run docker-compose up. And I am unsure because when I build this it shows that it is installing bower and npm files.




Aucun commentaire:

Enregistrer un commentaire