Best way to run webpack-dev-server when developing rails app using docker

Viewed 226

This is my docker-compose.yml for my Rails app. As you can see from the command:, I put the rails s into background then run webpack-dev-server so that my assets get compiled quickly during development.

version: '3'
services:
  app:
    depends_on:
      - 'db'
    build:
      context: .
      dockerfile: ./docker/app/Dockerfile
    command: bash -c "rm -f tmp/pids/server.pid && 
      bundle exec rails s -p 3000 -b '0.0.0.0' & ./bin/webpack-dev-server"
    ports:
      - '3000:3000'
    env_file: .env
    # For byebug to work
    stdin_open: true
    tty: true

This worked fine for me, until I want to debug using byebug. When I docker attach it just doesn't give me console to interact. And so I have to comment out the & ./bin/webpack-dev-server part every time I debug.

So how do you usually run the webpack-dev-server when dev on docker?

0 Answers
Related