Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.73 KB

README.md

File metadata and controls

53 lines (35 loc) · 1.73 KB

Vite Rails running on Docker

A minimal example on how to configure Docker to run a Vite.js process alongside a Rails app.

The integration is powered by Vite Rails.

Setup 💿

To prepare the Docker image, run:

docker-compose build

To start the Rails and Vite services, run:

docker-compose up

Debugging 🐞

Once you have started both services, you can verify that the Vite dev server can be reached from Rails by running:

docker-compose run --rm --entrypoint "bin/rails c" rails

and then:

> ViteRuby.instance.dev_server_running?
=> true

Further Configuration 📖

Now that you have learned the basics, please follow this guide instead for a more comprehensive configuration:

At the time of writing, the guide covers how to use Webpacker, but configuring Vite Rails should be very similar:

  • Use bundle exec ./bin/vite dev instead of bundle exec ./bin/webpack-dev-server
  • Expose port 3036 instead of 3035
  • Rename the webpacker service to vite
  • Rename WEBPACKER_DEV_SERVER_HOST to VITE_RUBY_HOST: