Skip to content

Commit 8635376

Browse files
add; Dockerfile for running inside a container and update README
1 parent c579c77 commit 8635376

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:alpine
2+
3+
# Default port is set to 3000.
4+
# This will be overriden if a diffferent value is provided as an argument for the container.
5+
ENV PORT 3000
6+
7+
RUN apk update
8+
RUN apk upgrade
9+
RUN apk add git bash curl wget
10+
RUN rm -rf /var/cache/apk/*
11+
12+
RUN mkdir -p /usr/src/app
13+
WORKDIR /usr/src/app
14+
15+
COPY package.json /usr/src/app/
16+
RUN npm install && npm cache clean --force
17+
COPY . /usr/src/app
18+
19+
CMD [ "npm", "start" ]

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,27 @@ all the config values we need to run the application:
1414
## A Note on API Keys
1515

1616
When you generate an API key pair at the URLs above, your API Secret will only
17-
be shown once - make sure to save this in a secure location,
17+
be shown once - make sure to save this in a secure location,
1818
or possibly your `~/.bash_profile`.
1919

2020
## Setting Up The Application
2121

2222
Create a configuration file for your application:
23+
2324
```bash
2425
cp .env.template .env
2526
```
2627

2728
Edit `.env` with the configuration parameters we gathered from above.
2829

2930
Next, we need to install our dependencies from npm:
31+
3032
```bash
3133
npm install
3234
```
3335

3436
Now we should be all set! Run the application:
37+
3538
```bash
3639
npm start
3740
```
@@ -43,6 +46,27 @@ video in both the tabs!
4346

4447
![screenshot of chat app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/video2.original.png)
4548

49+
## Using Docker
50+
51+
You need to build a docker image with the dependecies installed.
52+
53+
``` bash
54+
docker build -t video-quickstart-js .
55+
```
56+
57+
Once the image is created, you can run the container by running the `docker run` command. Replace the
58+
variables `$HOST_PORT`, `$PORT`.
59+
60+
``` bash
61+
docker run -it --rm \
62+
-p $HOST_PORT:$PORT \
63+
--env-file .env \
64+
video-quickstart-js:latest
65+
```
66+
67+
Add `-d` as an option for running in daemon mode.
68+
Add `--restart always` options for restarting the container incase of failure or system restart.
69+
4670
## Examples
4771

4872
The project contains some common use-case examples for the Twilio Video JS SDK.

0 commit comments

Comments
 (0)