Skip to content

Commit

Permalink
add; Dockerfile for running inside a container and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikmuralidharan committed Aug 26, 2017
1 parent c579c77 commit 8635376
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:alpine

# Default port is set to 3000.
# This will be overriden if a diffferent value is provided as an argument for the container.
ENV PORT 3000

RUN apk update
RUN apk upgrade
RUN apk add git bash curl wget
RUN rm -rf /var/cache/apk/*

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY package.json /usr/src/app/
RUN npm install && npm cache clean --force
COPY . /usr/src/app

CMD [ "npm", "start" ]
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,27 @@ all the config values we need to run the application:
## A Note on API Keys

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

## Setting Up The Application

Create a configuration file for your application:

```bash
cp .env.template .env
```

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

Next, we need to install our dependencies from npm:

```bash
npm install
```

Now we should be all set! Run the application:

```bash
npm start
```
Expand All @@ -43,6 +46,27 @@ video in both the tabs!

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

## Using Docker

You need to build a docker image with the dependecies installed.

``` bash
docker build -t video-quickstart-js .
```

Once the image is created, you can run the container by running the `docker run` command. Replace the
variables `$HOST_PORT`, `$PORT`.

``` bash
docker run -it --rm \
-p $HOST_PORT:$PORT \
--env-file .env \
video-quickstart-js:latest
```

Add `-d` as an option for running in daemon mode.
Add `--restart always` options for restarting the container incase of failure or system restart.

## Examples

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

0 comments on commit 8635376

Please sign in to comment.