Skip to content

Commit 0f4fe78

Browse files
authored
Add CSS building to Docker dev environment and fix docs (#586)
2 parents ecac69e + d5d3613 commit 0f4fe78

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

Dockerfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ EXPOSE 3000
4646
# Configure entrypoint to run Rails
4747
ENTRYPOINT ["./bin/docker-entrypoint.dev"]
4848

49-
# Start Rails server by default
50-
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
49+
# Start Tailwind CSS watcher and Rails server
50+
CMD ["sh", "-c", "bundle exec rails tailwindcss:watch & bundle exec rails server -b 0.0.0.0"]

README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SkillRX
2+
23
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.
34

45
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
1516

1617
[Contribution guidelines for this project](CONTRIBUTING.md)
1718

18-
1919
# Install & Setup
2020

2121
Clone the codebase
@@ -35,7 +35,7 @@ bin/setup
3535

3636
To run the app locally, use:
3737
```
38-
bin/dev
38+
bin/server
3939
```
4040

4141
To update dependencies in Gemfile, use:
@@ -48,39 +48,32 @@ You should see the seed organization by going to:
4848
http://localhost:3000/
4949
```
5050

51-
5251
# Running specs
5352

53+
This project uses:
54+
* `rspec` for testing
55+
* `shoulda-matchers` for expectations
56+
* `factory_bot` for making records
57+
58+
To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues.
59+
5460
```sh
5561
# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
56-
$ bundle exec rspec
62+
$ bin/rspec
5763

5864
# Run all spec files in a single directory (recursively)
59-
$ bundle exec rspec spec/models
65+
$ bin/rspec spec/models
6066

6167
# Run a single spec file
62-
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb
68+
$ bin/rspec spec/controllers/accounts_controller_spec.rb
6369

6470
# Run a single example from a spec file (by line number)
65-
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8
71+
$ bin/rspec spec/controllers/accounts_controller_spec.rb:8
6672

6773
# See all options for running specs
68-
$ bundle exec rspec --help
74+
$ bin/rspec --help
6975
```
7076

71-
# Setup
72-
73-
Clone this repo and run `bin/setup`. Run `bin/dev` or `bin/server` (if you like Overmind) to start working with app.
74-
75-
# Testing
76-
77-
This project uses:
78-
* `rspec` for testing
79-
* `shoulda-matchers` for expectations
80-
* `factory_bot` for making records
81-
82-
To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues.
83-
8477
# Docker Development Environment
8578

8679
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
10699
107100
4. Build and start the containers:
108101
```
109-
docker compose up
102+
make build
103+
make start
104+
```
105+
106+
Or directly with Docker Compose:
107+
```
108+
docker compose -f docker-compose.dev.yml up
110109
```
111110
112111
This will build the images and initialise the containers. You can exit and stop the containers using CTRL+C.
113112
114113
## Container Architecture
115-
The development environment consists of three containerised services:
116114
115+
The development environment consists of three containerised services:
117116
* app : Rails application service
118117
* Handles the main application logic
119118
* Runs on Ruby on Rails
@@ -142,7 +141,9 @@ make help
142141
```
143142

144143
## Common Tasks
144+
145145
### Rebuilding the Environment
146+
146147
To completely rebuild your development environment:
147148

148149
```bash
@@ -151,13 +152,15 @@ make rebuild
151152
This command will clean existing containers, rebuild images, and prepare the database.
152153

153154
### Viewing Logs
155+
154156
To monitor service logs:
155157
```
156158
make logs # View all container logs
157159
make logs app # View only Rails application logs
158160
```
159161

160162
### Container Management
163+
161164
Individual services can be managed using:
162165
```
163166
make start db # Start only the database container
@@ -166,9 +169,11 @@ make restart db # Restart only the database container
166169
```
167170

168171
### Troubleshooting
172+
169173
If you encounter issues:
170174
- Ensure all required ports are available on your system
171175
- Verify that your .env file contains all necessary variables
172176
- Try rebuilding the environment with make rebuild
173177
- Check container logs for specific error messages
178+
174179
# Test staging deployment

bin/dev

Lines changed: 0 additions & 3 deletions
This file was deleted.

bin/docker-entrypoint.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ bundle check || bundle install
99
# If running the rails server then create or migrate existing database
1010
./bin/rails db:prepare
1111

12+
# Build CSS assets
13+
./bin/rails tailwindcss:build
14+
1215
# Execute the main command passed to docker run
1316
exec "$@"

bin/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ FileUtils.chdir APP_ROOT do
3434
unless ARGV.include?("--skip-server")
3535
puts "\n== Starting development server =="
3636
STDOUT.flush # flush the output before exec(2) so that it displays
37-
exec "bin/dev"
37+
exec "bin/server"
3838
end
3939
end

0 commit comments

Comments
 (0)