Skip to content

Commit d818931

Browse files
add; instructions for using docker container and port specification
1 parent 9794008 commit d818931

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
TWILIO_ACCOUNT_SID=ACxxxxxxxxxx
22
TWILIO_API_KEY=SKxxxxxxxxxx
3-
TWILIO_API_SECRET=xxxxxxxxxx
3+
TWILIO_API_SECRET=xxxxxxxxxx

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
FROM node:alpine
22

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+
37
RUN apk update
8+
RUN apk upgrade
49
RUN apk add git bash curl wget
10+
RUN rm -rf /var/cache/apk/*
511

612
RUN mkdir -p /usr/src/app
713
WORKDIR /usr/src/app
@@ -11,4 +17,3 @@ RUN npm install && npm cache clean --force
1117
COPY . /usr/src/app
1218

1319
CMD [ "npm", "start" ]
14-
EXPOSE 3000

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)