Skip to content

Commit 8c6d5da

Browse files
committed
Add docker configuration for development
This makes it easier to run the test suite in your local dev environment
1 parent ecdc7eb commit 8c6d5da

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ruby:3.3
2+
3+
# Set the working directory in the container
4+
WORKDIR /app
5+
6+
# Copy the current directory contents into the container at /app
7+
COPY . /app
8+
9+
# Copy the sample config to the actual config (performed at build time)
10+
RUN cp spec/support/sample.docker.config.yml spec/support/config.yml
11+
12+
# Install any needed packages specified in Gemfile
13+
RUN bundle install
14+
15+
# Command to run the application
16+
CMD ["bash"]

docker-compose.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
services:
2+
ruby:
3+
image: ruby:3.3 # Manually change this based on the desired Ruby version
4+
working_dir: /app
5+
build: .
6+
environment:
7+
BUNDLE_GEMFILE: gemfiles/rails_7.2.gemfile # Manually change this based on the desired Rails version
8+
depends_on:
9+
- mysql
10+
- postgres
11+
12+
mysql:
13+
image: mysql:8.4
14+
environment:
15+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
16+
ports:
17+
- "3306:3306"
18+
healthcheck:
19+
test: ["CMD", "mysqladmin", "ping"]
20+
interval: 10s
21+
timeout: 5s
22+
retries: 3
23+
24+
postgres:
25+
image: postgres:16
26+
environment:
27+
POSTGRES_USER: postgres
28+
POSTGRES_PASSWORD: postgres
29+
PGUSER: postgres
30+
ports:
31+
- "5432:5432"
32+
healthcheck:
33+
test: ["CMD-SHELL", "pg_isready"]
34+
interval: 10s
35+
timeout: 5s
36+
retries: 5
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
mysql2:
2+
adapter: mysql2
3+
database: database_cleaner_test
4+
username: root
5+
password:
6+
host: mysql
7+
port: 3306
8+
encoding: utf8
9+
10+
trilogy:
11+
adapter: trilogy
12+
database: database_cleaner_test
13+
username: root
14+
password:
15+
host: mysql
16+
port: 3306
17+
encoding: utf8
18+
19+
postgres:
20+
adapter: postgresql
21+
database: database_cleaner_test
22+
username: postgres
23+
password: postgres
24+
host: postgres
25+
encoding: unicode
26+
template: template0
27+
28+
sqlite3:
29+
adapter: sqlite3
30+
database: tmp/database_cleaner_test.sqlite3
31+
pool: 5
32+
timeout: 5000
33+
encoding: utf8

0 commit comments

Comments
 (0)