Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Example Docker setup #77

@c-lliope

Description

@c-lliope

I wanted to provide my setup with webkit-rails and Docker – if possible, it would be nice to add some of this to the README.

Sample docker-compose.yml file. Note the -b and --host options, which expose the server processes to the host machine.

services:
  webpack:
    env_file: .env
    image: assemble/web
    command: /app/node_modules/.bin/webpack-dev-server --config config/webpack.config.js --host 0.0.0.0
    volumes:
      - .:/app
    ports:
      - 8888:8888

  web:
    build: .
    command: bundle exec rails s -p 3000 -b 0.0.0.0
    ports:
      - "$PORT:3000"
    links:
      - db
      - webpack
    volumes:
      - .:/app

Be sure to set the manifest_host to match the name of the docker-compose webpack service.

# config/application.rb
    config.webpack.dev_server.manifest_host = 'webpack'
    config.webpack.dev_server.manifest_port = 3808
    config.webpack.dev_server.port = 3808

When webpack runs inside a Docker container, it cannot observe the file change events that it needs to re-compile the assets. As a workaround, add to your webpack config:

// config/webkit.config.js
  watchOptions: {
    poll: true
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions