Skip to content

Commit 12f08c8

Browse files
author
Bruno Castro
committed
Include docker wrapper details to README
1 parent dc707d7 commit 12f08c8

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ If you want to just run the application in development mode, use the following c
1616

1717
```sh
1818
$ yarn dev
19+
1920
```
2021

2122
To run the application in debug mode in a way that the execution will stop when a debugger statement is called, use:
@@ -50,6 +51,66 @@ The boilerplate is prepared to run tests using Jest. We usually group the tests
5051
$ yarn test
5152
```
5253

54+
## Docker wrapper
55+
56+
This project includes a docker wrapper for development. Any command can be executed by calling the scripts under the `dbin/` folder.
57+
58+
```sh
59+
$ dbin/yarn dev
60+
61+
$ dbin/yarn debug
62+
63+
$ dbin/yarn cli
64+
65+
$ dbin/yarn remote [server address] [REPL port]
66+
```
67+
68+
The container runs using host networking, so there's no need to map ports. Keep in mind that environment variables should be added to the docker-compose.yml.
69+
70+
### Wrapper commands
71+
72+
```sh
73+
# Runs the command inside an ephemeral container using the app service described in the docker-compose file as a base (use the --root flag if the command should be run as root)
74+
$ dbin/run [--root] <command>
75+
76+
# Rebuild the image after any changes to the dockerfile
77+
$ dbin/build
78+
79+
# Remove all containers and their volumes (WARNING any cache or files not stored in the filesystem will be deleted)
80+
$ dbin/dispose
81+
82+
# Appends a RUN command to the base image, useful to install new packages
83+
$ dbin/chimg <command>
84+
```
85+
86+
### Wrapper Aliases
87+
88+
```sh
89+
# Creates a new <name> file in dbin to alias the <command> inside the docker container (use the --root flag if the command should be run as root)
90+
$ dbin/mkalias [--root] <name> <command>
91+
92+
# Opens a new terminal in the project folder (use the --root flag if the shell should assume the root user)
93+
$ dbin/shell [--root]
94+
95+
# Runs npm in the project folder
96+
$ dbin/npm
97+
98+
# Runs npx in the project folder
99+
$ dbin/npx
100+
101+
# Runs yarn in the project folder
102+
$ dbin/yarn
103+
```
104+
105+
### Wrapper Helpers
106+
107+
```bash
108+
# Adds dbin folder to the PATH only for the current terminal session.
109+
$ source dbin/local-env
110+
111+
# After using this command you can use the any script inside the dbin folder without the dbin/ prefix
112+
```
113+
53114
## Dependency injection
54115

55116
We use [Awilix](https://www.npmjs.com/package/awilix) to implement dependency injection and decouple the parts of your application. The boilerplate was developed in a way that each [module](#modules) is able to consume and augment the registered dependencies separately. Click here to know more about [inversion of control and dependency injection](https://www.martinfowler.com/articles/injection.html). The creator of Awilix also has a very good series of posts about the design decisions of the library that you can read [clicking here](https://medium.com/@Jeffijoe/dependency-injection-in-node-js-2016-edition-f2a88efdd427).

0 commit comments

Comments
 (0)