DEV Community

Discussion on: Docker for Frontend Devs: Custom Docker Images for Development

Collapse
vuesomedev profile image
Gábor Soós

The best thing about Docker is that you don't even need a custom Docker image for frontend development.

version: "3"

services:
  client:
    image: node:12
    working_dir: /app
    volumes:
      - ./:/app
    ports:
      - 8080:8080
    command: npm start

Before you start the server, one more command is needed:

docker-compose run --rm client npm install
docker-compose up

This way, the node_modules directory is accessible from the host machine, which means autocompletion inside the IDE. Plus, you don't have to fiddle with the Dockerfile.