From c30c0ca2bde1eff716e9b65e73a6152860e3ad42 Mon Sep 17 00:00:00 2001 From: dmitrytrager Date: Wed, 4 Feb 2026 12:19:22 +0100 Subject: [PATCH] Add CSS building to Docker dev environment and fix docs The Docker setup was only running `rails server` without building Tailwind CSS, resulting in unstyled pages. Add tailwindcss:build to the entrypoint for initial asset compilation and start tailwindcss:watch alongside the server in the container CMD. Also fix README Docker instructions to reference docker-compose.dev.yml, update bin/setup to use bin/server instead of removed bin/dev, and clean up duplicate/outdated README sections. Co-Authored-By: Claude Opus 4.5 --- Dockerfile.dev | 4 +-- README.md | 51 +++++++++++++++++++++------------------ bin/dev | 3 --- bin/docker-entrypoint.dev | 3 +++ bin/setup | 2 +- 5 files changed, 34 insertions(+), 29 deletions(-) delete mode 100755 bin/dev diff --git a/Dockerfile.dev b/Dockerfile.dev index e573e47c..bb87fc9d 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -46,5 +46,5 @@ EXPOSE 3000 # Configure entrypoint to run Rails ENTRYPOINT ["./bin/docker-entrypoint.dev"] -# Start Rails server by default -CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] +# Start Tailwind CSS watcher and Rails server +CMD ["sh", "-c", "bundle exec rails tailwindcss:watch & bundle exec rails server -b 0.0.0.0"] diff --git a/README.md b/README.md index 75da133d..03a4b51c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # SkillRX + SkillRX is a Ruby on Rails content management application which will allow medical training providers to upload and manage content which will be delivered to Raspberry Pi and other computers in low-resource areas for use by medical professionals at these locations. The project provides a ground-up rewrite of the [CMES Admin Panel](https://github.com/techieswithoutborders/cmes-admin-panel-next) for [Techies Without Borders](https://techieswithoutborders.us/). @@ -15,7 +16,6 @@ Thank you for checking out our work. We are in the process of setting up the rep [Contribution guidelines for this project](CONTRIBUTING.md) - # Install & Setup Clone the codebase @@ -35,7 +35,7 @@ bin/setup To run the app locally, use: ``` -bin/dev +bin/server ``` To update dependencies in Gemfile, use: @@ -48,39 +48,32 @@ You should see the seed organization by going to: http://localhost:3000/ ``` - # Running specs +This project uses: +* `rspec` for testing +* `shoulda-matchers` for expectations +* `factory_bot` for making records + +To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues. + ```sh # Default: Run all spec files (i.e., those matching spec/**/*_spec.rb) -$ bundle exec rspec +$ bin/rspec # Run all spec files in a single directory (recursively) -$ bundle exec rspec spec/models +$ bin/rspec spec/models # Run a single spec file -$ bundle exec rspec spec/controllers/accounts_controller_spec.rb +$ bin/rspec spec/controllers/accounts_controller_spec.rb # Run a single example from a spec file (by line number) -$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8 +$ bin/rspec spec/controllers/accounts_controller_spec.rb:8 # See all options for running specs -$ bundle exec rspec --help +$ bin/rspec --help ``` -# Setup - -Clone this repo and run `bin/setup`. Run `bin/dev` or `bin/server` (if you like Overmind) to start working with app. - -# Testing - -This project uses: -* `rspec` for testing -* `shoulda-matchers` for expectations -* `factory_bot` for making records - -To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues. - # Docker Development Environment This project is containerised using Docker to ensure consistent development environments across the team. @@ -106,14 +99,20 @@ This project is containerised using Docker to ensure consistent development envi 4. Build and start the containers: ``` - docker compose up + make build + make start + ``` + + Or directly with Docker Compose: + ``` + docker compose -f docker-compose.dev.yml up ``` This will build the images and initialise the containers. You can exit and stop the containers using CTRL+C. ## Container Architecture -The development environment consists of three containerised services: +The development environment consists of three containerised services: * app : Rails application service * Handles the main application logic * Runs on Ruby on Rails @@ -142,7 +141,9 @@ make help ``` ## Common Tasks + ### Rebuilding the Environment + To completely rebuild your development environment: ```bash @@ -151,6 +152,7 @@ make rebuild This command will clean existing containers, rebuild images, and prepare the database. ### Viewing Logs + To monitor service logs: ``` make logs # View all container logs @@ -158,6 +160,7 @@ make logs app # View only Rails application logs ``` ### Container Management + Individual services can be managed using: ``` make start db # Start only the database container @@ -166,9 +169,11 @@ make restart db # Restart only the database container ``` ### Troubleshooting + If you encounter issues: - Ensure all required ports are available on your system - Verify that your .env file contains all necessary variables - Try rebuilding the environment with make rebuild - Check container logs for specific error messages + # Test staging deployment diff --git a/bin/dev b/bin/dev deleted file mode 100755 index 06f6d953..00000000 --- a/bin/dev +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby - -exec "./bin/rails", "server", *ARGV diff --git a/bin/docker-entrypoint.dev b/bin/docker-entrypoint.dev index 6022d807..146b2606 100755 --- a/bin/docker-entrypoint.dev +++ b/bin/docker-entrypoint.dev @@ -9,5 +9,8 @@ bundle check || bundle install # If running the rails server then create or migrate existing database ./bin/rails db:prepare +# Build CSS assets +./bin/rails tailwindcss:build + # Execute the main command passed to docker run exec "$@" diff --git a/bin/setup b/bin/setup index ba503b16..4dc30ea8 100755 --- a/bin/setup +++ b/bin/setup @@ -34,6 +34,6 @@ FileUtils.chdir APP_ROOT do unless ARGV.include?("--skip-server") puts "\n== Starting development server ==" STDOUT.flush # flush the output before exec(2) so that it displays - exec "bin/dev" + exec "bin/server" end end