Skip to content

Commit e99d032

Browse files
committed
fix: broken docker configuration and update Docker.md
1 parent 6d53158 commit e99d032

File tree

4 files changed

+80
-61
lines changed

4 files changed

+80
-61
lines changed

.dockerignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dependency directories
2+
node_modules
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Documentation
12+
docs/
13+
14+
# Misc.
15+
.vscode/
16+
build/

Dockerfile

-20
This file was deleted.

docker-compose.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
version: '3'
2+
23
services:
34
webpack:
45
container_name: dim-webpack
5-
image: node:fermium
6+
image: node:18
67
ports:
7-
- '8080:8080'
8+
- 8080:8080
89
working_dir: /usr/src/app
910
command: >
10-
bash -c "yarn install &&
11-
yarn start"
11+
bash -c "git config --global --add safe.directory /usr/src/app && yarn install --frozen-lockfile --prefer-offline && yarn start"
1212
environment:
13-
- NODE_ENV=dev
13+
- NODE_ENV=development
1414
- DOCKER=true
1515
restart: 'no'
1616
volumes:
1717
- .:/usr/src/app
18+
- ./config/:/usr/src/app
1819
- node_modules:/usr/src/app/node_modules
19-
volumes:
20-
node_modules:
2120

21+
volumes:
22+
node_modules: {}
23+
24+
networks:
25+
dim:
26+
name: dim

docs/Docker.md

+52-34
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,86 @@
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
82

93
### Pre-Requisites
4+
To get started with Docker, follow the steps below.
105

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.
147

15-
### Docker Compose Up
8+
If you already have docker-compose installed on your machine, you may skip to step 3.
169

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
1715
Run the following commands from the DIM cloned directory on your machine:
1816

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
2319
* `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
2422

25-
### Tips and Troubleshooting
23+
> Building dist files will take a while on the first startup while yarn installs dependencies and webpack builds DIM.
2624
25+
### Tips and Troubleshooting
2726
You can get an interactive terminal with `docker-compose exec webpack bash`.
2827

28+
This is very useful for troubleshooting issues that arise inside of the container when it's spun up.
29+
30+
31+
2932
## Commit hook won't run
33+
If you `git commit` inside the container, you may see one of the following warnings:
3034

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+
```
3243

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.
3745

38-
This can be fixed with the suggested commands.
3946

40-
## No editor on system
4147

48+
## No editor on system
4249
When using `git commit`, you may encounter:
4350

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'`
4653

4754
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:
4855

49-
git commit -m "This is my commit message"
56+
```sh
57+
git commit -m "This is my commit message"
58+
```
5059

51-
For an interactive editor, try:
60+
For an interactive editor, try `nano` or `vim`:
5261

53-
apt-get update
54-
apt-get install nano
62+
```sh
63+
apt-get update
64+
apt-get install nano
65+
```
5566

56-
This will install the `nano` editor. Another option is `vim`.
5767

58-
## Node modules
5968

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.
6176

62-
## Container terminates unexpectedly
6377

78+
79+
## Container terminates unexpectedly
6480
On Windows, you may see the error:
6581

66-
dim-webpack | error Command failed with exit code 137.
82+
```sh
83+
dim-webpack | error Command failed with exit code 137.
84+
```
6785

6886
This may indicate that the Docker VM which hosts containers has run out of memory, and a higher setting is needed.

0 commit comments

Comments
 (0)