File tree 3 files changed +38
-12
lines changed
3 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ Ready to run in production? Please [check our deployment guides](http://www.phoe
21
21
22
22
## Docker
23
23
24
+ ### Running the application
25
+
26
+ ``` shell
27
+ docker-compose run --rm local
28
+ ```
29
+
24
30
### Provisioning the Database
25
31
26
32
``` shell
@@ -32,3 +38,9 @@ docker-compose run --rm local sh -c "mix ecto.create"
32
38
``` shell
33
39
docker-compose run --rm local sh -c " mix ecto.migrate"
34
40
```
41
+
42
+ ### Running Tests
43
+
44
+ ``` shell
45
+ docker-compose run --rm test
46
+ ```
Original file line number Diff line number Diff line change @@ -12,8 +12,5 @@ config :logger, level: :warn
12
12
# Configure your database
13
13
config :rest_api , RestApi.Repo ,
14
14
adapter: Ecto.Adapters.Postgres ,
15
- username: "postgres" ,
16
- password: "postgres" ,
17
- database: "rest_api_test" ,
18
- hostname: "localhost" ,
15
+ url: { :system , "DATABASE_URL" } ,
19
16
pool: Ecto.Adapters.SQL.Sandbox
Original file line number Diff line number Diff line change
1
+ db : &DB
2
+ image : postgres:9.4.5
3
+ ports :
4
+ - 5432
5
+ environment :
6
+ POSTGRES_USER : user
7
+ POSTGRES_PASSWORD : password
8
+
9
+
10
+ # Separate database for testing (since it gets deleted)
11
+ dbTest :
12
+ << : *DB
13
+
14
+
1
15
local :
2
16
build : .
17
+ command : sh -c "mix phoenix.server"
3
18
ports :
4
19
- 4000
5
- environment :
20
+ environment : &ENV
6
21
VIRTUAL_HOST : api.local.dockito.org
7
22
VIRTUAL_PORT : 4000
8
23
DATABASE_URL : ecto://user:password@db/rest_api_dev
9
24
volumes :
10
25
- ./:/usr/src/app
11
26
links :
12
- - postgres :db
27
+ - db :db
13
28
14
29
15
- postgres :
16
- image : postgres:9.4.5
17
- ports :
18
- - ' 5432:5432'
30
+ test :
31
+ build : .
32
+ command : sh -c "mix test"
19
33
environment :
20
- POSTGRES_USER : user
21
- POSTGRES_PASSWORD : password
34
+ DATABASE_URL : ecto://user:password@db/rest_api_test
35
+ volumes :
36
+ - ./:/usr/src/app
37
+ links :
38
+ - dbTest:db
You can’t perform that action at this time.
0 commit comments