Docker Development Environment
We recommend using Docker to get your project setup from the beginning. This ensures that you have a stable development environment, no matter what OS or system you're using to develop.
It also allows you to troubleshoot and debug the application since the development container is small and simple with very few dependencies.
1. Initial Setup
First, you'll need to install Docker. You can download it from Docker's website.
You'll also need Just, the command
runner we use for every shortcut in the justfile. Install it with your
package manager — for example brew install just on macOS — or follow
the
installation instructions
for other platforms.
Once both are installed, create a new directory for your project:
mkdir -p ~/Development/mycompany/myproject
cd ~/Development/mycompany/myproject
2. Configuration Files
Look in the examples directory of the LocoMotion
repository
for these basic configuration files:
| File | Purpose |
|---|---|
docker-compose.yml
| Defines your application services |
Dockerfile
| Instructions for building your app container |
Dockerfile.dev
| Development environment container |
entrypoint.sh
| Script that runs when containers start |
justfile
| Shortcuts for common commands |
Copy these files into your project directory. Your directory structure should look like this:
~/Development
└── mycompany
└── myproject
├── Dockerfile
├── Dockerfile.dev
├── justfile
├── docker-compose.yml
└── entrypoint.sh3. Starting the Development Environment
With these files in place, you can now start your development environment:
just dev
This command will build and run all the necessary containers. Once they have started, open a shell in your development container with:
just dev-shell
Next: Create Your App
With the containers built and a shell open via just dev-shell, your
development environment is ready — consistent across any OS, simple to
debug, and isolated from your host system's dependencies.
From here, the Rails Setup guide picks up
exactly where this one leaves off: creating the Rails app with
rails new, configuring the database, and applying the
LocoMotion-recommended setup (UUIDs, HAML, DaisyUI, and more).