diff --git a/.env.template b/.env.template index 9bdf434a..2a9de4d8 100644 --- a/.env.template +++ b/.env.template @@ -1,3 +1,3 @@ TWILIO_ACCOUNT_SID=ACxxxxxxxxxx TWILIO_API_KEY=SKxxxxxxxxxx -TWILIO_API_SECRET=xxxxxxxxxx +TWILIO_API_SECRET=xxxxxxxxxx \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 17fa533e..46ddb61e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,13 @@ 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 @@ -11,4 +17,3 @@ RUN npm install && npm cache clean --force COPY . /usr/src/app CMD [ "npm", "start" ] -EXPOSE 3000 diff --git a/README.md b/README.md index f2489b06..bcab8de3 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,13 @@ 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 ``` @@ -27,11 +28,13 @@ 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 ``` @@ -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.