Skip to content

Commit baa6128

Browse files
bors[bot]thicolarescurquiza
authored
Merge #251
251: Add a docker-composer file for local development r=curquiza a=thicolares Closes #250. Co-authored-by: Thiago Colares <[email protected]> Co-authored-by: Clémentine Urquizar - curqui <[email protected]>
2 parents 24efc88 + 1fad11e commit baa6128

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ To update it, run the following command:
8989
bundle exec rubocop --auto-gen-config
9090
```
9191

92+
### Using Docker Compose <!-- omit in toc -->
93+
94+
If you have Docker and Docker Compose installed, you can alternatively set up your local development environment following the steps below.
95+
96+
```bash
97+
# Create/run the containers
98+
docker compose up -d
99+
# Run bash in meilisearch_ruby container
100+
docker compose exec meilisearch_ruby bash
101+
```
102+
103+
You can now run the previous steps in the `meilisearc_ruby` container:
104+
105+
```bash
106+
bundle install
107+
bundle exec rspec
108+
bundle exec rubocop lib/ spec/
109+
...
92110
### Want to debug? <!-- omit in toc -->
93111

94112
You can use the [`byebug` gem](https://github.com/deivid-rodriguez/byebug).

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: "3.7"
2+
3+
services:
4+
meilisearch_ruby:
5+
image: ruby
6+
tty: true
7+
stdin_open: true
8+
working_dir: /home/app
9+
environment:
10+
- MEILISEARCH_HOST=meilisearch
11+
- MEILISEARCH_PORT=7700
12+
ports:
13+
- "3001:3000"
14+
volumes:
15+
- ./:/home/app
16+
17+
meilisearch:
18+
image: getmeili/meilisearch:latest
19+
tty: true
20+
stdin_open: true
21+
container_name: meilisearch
22+
ports:
23+
- "7700:7700"
24+
# Uncomment this to run the test suite
25+
# environment:
26+
# - MEILI_MASTER_KEY=masterKey

spec/spec_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
require 'byebug'
2929

3030
# Globals for all tests
31-
URL = 'http://localhost:7700'
31+
URL = format('http://%<host>s:%<port>s',
32+
host: ENV.fetch('MEILISEARCH_HOST', 'localhost'), port: ENV.fetch('MEILISEARCH_PORT', '7700'))
3233
MASTER_KEY = 'masterKey'
3334
DEFAULT_SEARCH_RESPONSE_KEYS = [
3435
'hits',

0 commit comments

Comments
 (0)