10

i have some scenario that i cant solve. angular 5 application development. docker file that copies the package.json and during the build npm installs the node_modules. and i want those node_modules to be visible on host so developer can work comfortably on /src folder. application works from container but when coding i cant use autocomplete because modules are not available.

FROM node:10 as node
# FROM node:alpine as node
RUN mkdir -p /app
WORKDIR /app
COPY . /app/
RUN npm install -g @angular/cli@~6.0.3
# RUN yarn --pure-lockfile
# RUN yarn install --no-cache --frozen-lockfile --no-bin-links
RUN npm install
EXPOSE 4200
CMD ng serve --host 0.0.0.0 --disable-host-check --watch --poll 1000

docker-compose.yaml

version: '3'

services:
  frontend-service:
    build: ./frontend
    volumes:
      - ./frontend:/app
      - /app/node_modules
    ports:
      - 4200:4200

enter image description here any hints?

pinarella
  • 805
  • 8
  • 16
  • 3
    Possible duplicate of [Install node\_modules inside Docker container and synchronize them with host](https://stackoverflow.com/questions/51097652/install-node-modules-inside-docker-container-and-synchronize-them-with-host) – OneCricketeer Dec 02 '18 at 17:44

0 Answers0