Sunday, January 6, 2019

Docker and node_modules

Development environment for a NodeJS App


Dockefile

FROM node:16-alpine

WORKDIR /app

COPY package.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

.dockerignore

node_modules
npm-debug.log
.git
Dockerfile
.dockerignore

Open your browser on http://localhost:3000

docker-compose.yaml
version: "3.8"

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - './src:/app/src'
      - './public/assets:/app/public/assets'
      - '/app/node_modules'
    ports:
      - 3000:3000
    stdin_open: true
    environment:
      - CHOKIDAR_USEPOLLING=true

No comments:

Post a Comment