Skip to content

Commit 80c35dc

Browse files
edenhermelinbrandonroberts
authored andcommitted
docs(example): update ngrx.io for docker and offline support (ngrx#1806)
Closes ngrx#1698
1 parent 8755d07 commit 80c35dc

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
npm-debug.log
3+
Dockerfile*
4+
docker-compose*
5+
.dockerignore
6+
.git
7+
.gitignore

Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:10.15.3
2+
3+
# Create app directory
4+
WORKDIR /platform
5+
6+
COPY . .
7+
8+
WORKDIR /platform/projects/ngrx.io
9+
10+
# Install all the dependencies, boilerplate, stackblitz, zips and run dgeni on the docs.
11+
RUN yarn setup
12+
13+
EXPOSE 4200
14+
15+
CMD ["yarn", "start:docker"]

projects/ngrx.io/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ Running `yarn start` (even when explicitly targeting production mode) does not s
5252
ServiceWorker. If you want to test the ServiceWorker locally, you can use `yarn build` and then
5353
serve the files in `dist/` with `yarn http-server dist -p 4200`.
5454

55+
## Running on Docker
56+
57+
The ngrx.io sample project can run as a docker container.
58+
In order to run ngrx.io on docker, use the following commands (**run commands from the platform folder**):
59+
* `docker build -t ngrx-docs:7.4.0 .` - building the ngrx.io app image
60+
* `docker run -p <host-port>:4200 ngrx-docs:7.4.0` - starting the container, listening on *<host-port>* for your choice.
61+
62+
The container will run the documentation app with the script `start:docker` with the **stable configuration** and with 0.0.0.0
63+
host support.
64+
* Saving the image for later offline usage is available by building the container and then using `sudo docker save ngrx-docs:7.4.0 > <tar-name>.tar`
65+
and loading it afterwards with `sudo docker load < <tar-name>.tar`.
66+
> tested on ubuntu 18.04.2 with Docker 18.09.4
67+
5568
## Guide to authoring
5669

5770
There are two types of content in the documentation:

projects/ngrx.io/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"aio-check-local": "node tools/ng-packages-installer check .",
1313
"ng": "yarn check-env && ng",
1414
"start": "yarn check-env && ng serve --configuration=fast",
15+
"start:docker": "yarn check-env && ng serve --configuration=stable --host 0.0.0.0",
1516
"build": "yarn build-for stable",
1617
"prebuild-for": "yarn setup",
1718
"build-for": "yarn ~~build --configuration",

0 commit comments

Comments
 (0)