- Docker and Docker Compose
# 1. Build the Docker image
docker build -f Dockerfile.dev -t lcms-core:dev .
# 2. Start database and Redis
docker compose up -d db redis
# 3. Create PostgreSQL extensions and database
docker compose exec db sh -c "psql -U postgres -d template1 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
docker compose exec db sh -c "psql -U postgres -c 'CREATE DATABASE lcms;'"
# 4. Install dependencies
docker compose run --rm rails bundle install
docker compose run --rm rails yarn install
# 5. Setup database
docker compose run --rm rails rails db:migrate
docker compose run --rm rails rails db:seed
# 6. Start all services
docker compose upThe application will be available at http://localhost:3000
All commands run inside Docker containers:
# Rails console
docker compose run --rm rails rails console
# Run database migrations
docker compose run --rm rails rails db:migrate
# Build JavaScript assets
docker compose run --rm js yarn build
# Build CSS assets
docker compose run --rm rails yarn build:css# Setup test database (first time only)
docker compose run --rm -e RAILS_ENV=test rails rails db:create
docker compose run --rm -e RAILS_ENV=test rails rails db:migrate
# Run all tests
docker compose run --rm test bundle exec rspec
# Run specific test file
docker compose run --rm test bundle exec rspec spec/path/to/file_spec.rb
# Run specific test by line number
docker compose run --rm test bundle exec rspec spec/path/to/file_spec.rb:42# Run Rubocop
docker compose run --rm rails bundle exec rubocop
# Auto-fix style issues
docker compose run --rm rails bundle exec rubocop -a| Service | Description | Port |
|---|---|---|
| rails | Main Rails application | 3000 |
| db | PostgreSQL 17.6 | 5432 |
| redis | Redis 7 | 6379 |
| resque | Background job workers | - |
| css | CSS asset watcher | - |
| js | JavaScript asset builder | - |
| test | Test runner | - |
To build a multi-platform image for both amd64 and arm64 architectures:
# Create a new builder instance (only needed once)
docker buildx create --name multiplatform-builder --use
# Build and push multi-platform image to registry
docker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile.dev \
-t lcms-core:dev \
--push .
# Or build and load locally (single platform only)
docker buildx build --platform linux/arm64 \
-f Dockerfile.dev \
-t lcms-core:dev \
--load .Note: The
--pushflag requires authentication to a container registry. The--loadflag only works with a single platform as Docker cannot load multi-platform images locally.