|
1 |
| -# Docker Compose Quick Start |
2 |
| - |
3 |
| -Install Dependencies, and start webpack, with Docker |
4 |
| - |
5 |
| -1. [Pre-requisites](#pre-requisites) |
6 |
| -1. [Docker-compose up](#docker-compose-up) |
7 |
| -1. Refer to [Entering your API credentials in CONTRIBUTING.md](CONTRIBUTING.md#enter-api-credentials) |
| 1 | +# Docker Development Quick Start |
8 | 2 |
|
9 | 3 | ### Pre-Requisites
|
| 4 | +To get started with Docker, follow the steps below. |
10 | 5 |
|
11 |
| -* Install Docker https://www.docker.com/get-started |
12 |
| -* Install docker-compose https://docs.docker.com/compose/install/ |
13 |
| -* Follow the steps for getting an API key in [CONTRIBUTING.md](CONTRIBUTING.md#get-your-own-api-key) |
| 6 | +If you already have Docker installed on your machine, you may skip to step 2. |
14 | 7 |
|
15 |
| -### Docker Compose Up |
| 8 | +If you already have docker-compose installed on your machine, you may skip to step 3. |
16 | 9 |
|
| 10 | +1. Install Docker ([https://www.docker.com/get-started](https://www.docker.com/get-started)) |
| 11 | +2. Install docker-compose ([https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)) |
| 12 | +3. Getting an API key in [CONTRIBUTING.md](CONTRIBUTING.md#get-your-own-api-key) |
| 13 | + |
| 14 | +### Managing DIM Docker Containers |
17 | 15 | Run the following commands from the DIM cloned directory on your machine:
|
18 | 16 |
|
19 |
| -* `docker-compose up` to build the dist and start yarn watcher |
20 |
| -* It will take a while for the dist files to build on the first startup while yarn installs dependencies |
21 |
| -* `ctrl+c` to stop |
22 |
| -* `docker-compose up -d` to start in detached mode |
| 17 | +* `docker-compose up` to start the docker containers and build the dist files |
| 18 | +* `docker-compose up -d` to start the containers and build the dist files in detached mode |
23 | 19 | * `docker-compose stop` to stop detached mode
|
| 20 | +* `docker-compose down` to stop the container and purge its containers and networks |
| 21 | +* `ctrl+c` to stop |
24 | 22 |
|
25 |
| -### Tips and Troubleshooting |
| 23 | +> Building dist files will take a while on the first startup while yarn installs dependencies and webpack builds DIM. |
26 | 24 |
|
| 25 | +### Tips and Troubleshooting |
27 | 26 | You can get an interactive terminal with `docker-compose exec webpack bash`.
|
28 | 27 |
|
| 28 | +This is very useful for troubleshooting issues that arise inside of the container when it's spun up. |
| 29 | + |
| 30 | + |
| 31 | + |
29 | 32 | ## Commit hook won't run
|
| 33 | +If you `git commit` inside the container, you may see one of the following warnings: |
30 | 34 |
|
31 |
| -If you `git commit` inside the container, you may see: |
| 35 | +```txt |
| 36 | +Can't find Husky, skipping pre-commit hook |
| 37 | +You can reinstall it using `npm install husky --save-dev` or delete this hook |
| 38 | +``` |
| 39 | +```txt |
| 40 | +Can't find Husky, skipping prepare-commit-msg hook |
| 41 | +You can reinstall it using `npm install husky --save-dev` or delete this hook |
| 42 | +``` |
32 | 43 |
|
33 |
| - Can't find Husky, skipping pre-commit hook |
34 |
| - You can reinstall it using 'npm install husky --save-dev' or delete this hook |
35 |
| - Can't find Husky, skipping prepare-commit-msg hook |
36 |
| - You can reinstall it using 'npm install husky --save-dev' or delete this hook |
| 44 | +These can be fixed with the suggested commands. |
37 | 45 |
|
38 |
| -This can be fixed with the suggested commands. |
39 | 46 |
|
40 |
| -## No editor on system |
41 | 47 |
|
| 48 | +## No editor on system |
42 | 49 | When using `git commit`, you may encounter:
|
43 | 50 |
|
44 |
| - error: cannot run editor: No such file or directory |
45 |
| - error: unable to start editor 'editor' |
| 51 | +- `error: cannot run editor: No such file or directory` |
| 52 | +- `error: unable to start editor 'editor'` |
46 | 53 |
|
47 | 54 | This means that `git` cannot launch a text-editor for you to customize your commit-message with. A quick workaround is to use the `-m` flag, ex:
|
48 | 55 |
|
49 |
| - git commit -m "This is my commit message" |
| 56 | +```sh |
| 57 | +git commit -m "This is my commit message" |
| 58 | +``` |
50 | 59 |
|
51 |
| -For an interactive editor, try: |
| 60 | +For an interactive editor, try `nano` or `vim`: |
52 | 61 |
|
53 |
| - apt-get update |
54 |
| - apt-get install nano |
| 62 | +```sh |
| 63 | +apt-get update |
| 64 | +apt-get install nano |
| 65 | +``` |
55 | 66 |
|
56 |
| -This will install the `nano` editor. Another option is `vim`. |
57 | 67 |
|
58 |
| -## Node modules |
59 | 68 |
|
60 |
| -If you need to install new node dependencies, you should run those commands from inside the container. Once inside, use `yarn add NameOfTheDependency` as normal. |
| 69 | +## Installing new packages |
| 70 | +If you need to install new node dependencies, you should run those commands from inside the container via: |
| 71 | +```sh |
| 72 | +docker-compose exec webpack bash |
| 73 | +``` |
| 74 | + |
| 75 | +Once inside, use `yarn add NameOfTheDependency` as normal. |
61 | 76 |
|
62 |
| -## Container terminates unexpectedly |
63 | 77 |
|
| 78 | + |
| 79 | +## Container terminates unexpectedly |
64 | 80 | On Windows, you may see the error:
|
65 | 81 |
|
66 |
| - dim-webpack | error Command failed with exit code 137. |
| 82 | +```sh |
| 83 | +dim-webpack | error Command failed with exit code 137. |
| 84 | +``` |
67 | 85 |
|
68 | 86 | This may indicate that the Docker VM which hosts containers has run out of memory, and a higher setting is needed.
|
0 commit comments