Skip to content

Commit 3275929

Browse files
committed
cleaning up docker scripts
1 parent 5c4a714 commit 3275929

File tree

7 files changed

+38
-38
lines changed

7 files changed

+38
-38
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ language: node_js
77
node_js:
88
- "8"
99
script:
10-
- ./docker/test-travis.sh
10+
- ./docker/test.sh

docker/README.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
### Contrubiting to this Project
2+
#### Run the Dev Server
3+
To use Docker to run the source code in a local development environment:
4+
1. Clone this repo
5+
2. Build the docker image
6+
* `cd react-json-view`
7+
* `./docker/build-container.sh`
8+
* *note:* you may need to use `sudo` to run docker commands
9+
3. Run the docker container on port 2000. This will run the webpack-dev-server with hot-reloading enabled.
10+
* `./docker/dev-server.sh`
11+
* *note:* you may need to use `sudo` to run the server file
12+
4. Open port 2000 in your browser
13+
* navigate to localhost:2000
14+
15+
Your source code will be mounted inside the docker container. The container is built on the latest `Node:slim` image.
16+
17+
Webpack-dev-server is running in the container and hot-reloading when changes are made locally.
18+
19+
All node modules are installed within the container, so make sure to rebuild your container if you make changes to package.json (see step 2, above).
20+
21+
#### Run the Production Build
22+
```bash
23+
cd react-json-view
24+
# build the rjv container
25+
./docker/build-container.sh
26+
# run the build within your docker container
27+
./docker/build-dist.sh
28+
```
29+
130
### Motivation for adding Docker to your Development Stack
231

332
**PSA:** You do not need to use Docker to contribute to this project. If you're not interested in using a container for development, you can ignore this directory.
@@ -68,32 +97,3 @@ running the app inside a container ensures that environmental inconsistencies li
6897
#### more examples
6998

7099
[github-help-wanted](https://github.com/mac-s-g/github-help-wanted) is a newer project that has a simpler docker workflow.
71-
72-
### Contrubiting to this Project
73-
#### Run the Dev Server
74-
To use Docker to run the source code in a local development environment:
75-
1. Clone this repo
76-
2. Build the docker image
77-
* `cd react-json-view`
78-
* `./docker/build-container.sh`
79-
* *note:* you may need to use `sudo` to run docker commands
80-
3. Run the docker container on port 2000. This will run the webpack-dev-server with hot-reloading enabled.
81-
* `./docker/dev-server.sh`
82-
* *note:* you may need to use `sudo` to run the server file
83-
4. Open port 2000 in your browser
84-
* navigate to localhost:2000
85-
86-
Your source code will be mounted inside the docker container. The container is built on the latest `Node:slim` image.
87-
88-
Webpack-dev-server is running in the container and hot-reloading when changes are made locally.
89-
90-
All node modules are installed within the container, so make sure to rebuild your container if you make changes to package.json (see step 2, above).
91-
92-
#### Run the Production Build
93-
```bash
94-
cd react-json-view
95-
# build the rjv container
96-
./docker/build-container.sh
97-
# run the build within your docker container
98-
./docker/build-dist.sh
99-
```

docker/entrypoints/dev-server.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
mkdir -p /react/dist || true
55
cd /react
6-
exec npm run dev:hot
6+
exec npm run dev

docker/entrypoints/test-travis.sh renamed to docker/entrypoints/test-watch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
echo Running Tests
33
cd /react
44

5-
exec npm run test
5+
exec npm run test:watch

docker/entrypoints/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
echo Running Tests
33
cd /react
44

5-
exec npm run test:watch
5+
exec npm run test

docker/test-travis.sh renamed to docker/test-watch.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ echo "Running with NODE_ENV=$NODE_ENV"
77
# run the workbench container
88
docker run \
99
-v $(pwd)/src:/react/src \
10-
-v $(pwd)/coverage:/react/coverage \
10+
-v $(pwd)/dev-server:/react/dev-server \
1111
-v $(pwd)/webpack/webpack.config.js:/react/webpack.config.js \
1212
-v $(pwd)/test:/react/test \
1313
-v $(pwd)/docker:/react/docker \
1414
--rm \
1515
-e NODE_ENV=$NODE_ENV \
16-
--entrypoint=/react/docker/entrypoints/test-travis.sh \
17-
-t react-json-view
16+
--entrypoint=/react/docker/entrypoints/test-watch.sh \
17+
-t react-json-view

docker/test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ echo "Running with NODE_ENV=$NODE_ENV"
77
# run the workbench container
88
docker run \
99
-v $(pwd)/src:/react/src \
10-
-v $(pwd)/dev-server:/react/dev-server \
10+
-v $(pwd)/coverage:/react/coverage \
1111
-v $(pwd)/webpack/webpack.config.js:/react/webpack.config.js \
1212
-v $(pwd)/test:/react/test \
1313
-v $(pwd)/docker:/react/docker \
1414
--rm \
1515
-e NODE_ENV=$NODE_ENV \
1616
--entrypoint=/react/docker/entrypoints/test.sh \
17-
-t react-json-view
17+
-t react-json-view

0 commit comments

Comments
 (0)