Skip to content

Commit 28d9ac3

Browse files
a-magdyjakearchibald
authored andcommitted
Update docker compose (jakearchibald#24)
* Update docker-compose.yml to run using a volume * Add package-lock.json * Update package-lock.json * Add start script to package.json It runs npm install if node_modules folder doesn't exist then runs the serve script * Add a newline at the end of docker-compose.yml file * Update README.md * Add start.sh script and use it in docker-compose.yml * Add newline at the end of start.sh script * Small update in README.md * Update container_name in docker-compose.yml * Update package-lock.json to fix `npm ERR! code EINTEGRITY` * Update docker-compose.yml command to use start.sh script * Remove start script from package.json * Rename service name in docker-compose from witter to wittr * Remove package-lock.json * Remove start.sh, update the command in docker-compose.yml and update README.md * Update README.md, moving the running on local machine section on top * Minor grammar changes
1 parent 196c7d4 commit 28d9ac3

File tree

2 files changed

+50
-12
lines changed

2 files changed

+50
-12
lines changed

README.md

+31-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
This is a silly little demo app for an offline-first course.
44

5-
# Installing
5+
You could run the app either using machine dependnecies, or using docker
6+
7+
## Running using local machine
8+
9+
### Installing
610

711
Dependencies:
812

@@ -14,12 +18,14 @@ Then check out the project and run:
1418
npm install
1519
```
1620

17-
# Running
21+
### Running
1822

1923
```sh
2024
npm run serve
2125
```
2226

27+
### Using the app
28+
2329
You should now have the app server at [localhost:8888](http://localhost:8888) and the config server at [localhost:8889](http://localhost:8889).
2430

2531
You can also configure the ports:
@@ -28,9 +34,27 @@ You can also configure the ports:
2834
npm run serve -- --server-port=8000 --config-server-port=8001
2935
```
3036

31-
# Troubleshooting
37+
## Running using docker
38+
39+
```sh
40+
docker-compose up
41+
```
42+
43+
Here also you should have the app server at [localhost:8888](http://localhost:8888) and the config server at [localhost:8889](http://localhost:8889).
44+
45+
You can configure the ports by changing them in `docker-compose.yml` before starting:
46+
47+
```yml
48+
ports:
49+
# <host>:<container>
50+
- 8000:8888
51+
- 8001:8889
52+
```
53+
54+
## Troubleshooting
3255
33-
- Errors while executing `npm run serve`
34-
- The first thing to try is to upgrade to latest version of node
35-
- If latest version also produces errors, try installing v4.5.0
36-
- An easy for that would be to use `nvm` as discussed [here](http://stackoverflow.com/a/7718438/1585523)
56+
* Errors while executing `npm run serve`.
57+
* The first thing to try is to upgrade to latest version of node.
58+
* If latest version also produces errors, try installing v4.5.0.
59+
* An easy fix for that would be [to use `nvm`](http://stackoverflow.com/a/7718438/1585523).
60+
* If you get any node-sass errors, try running `npm rebuild node-sass --force` or the remove `node_modules` folder and run `npm install` again

docker-compose.yml

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
witter:
2-
build: .
3-
ports:
4-
- 8888:8888
5-
- 8889:8889
1+
version: '2.1'
2+
3+
services:
4+
wittr:
5+
image: node:latest
6+
container_name: c-wittr
7+
command: /bin/bash -c "if [ ! -d node_modules ] ; then npm install ; fi && npm run serve"
8+
working_dir: /usr/src/app
9+
volumes:
10+
- .:/usr/src/app
11+
ports:
12+
- 8888:8888
13+
- 8889:8889
14+
healthcheck:
15+
test: "wget -q -O - http://localhost:8888"
16+
interval: 1s
17+
timeout: 30s
18+
retries: 300
19+
restart: unless-stopped

0 commit comments

Comments
 (0)