diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..46ddb61e --- /dev/null +++ b/Dockerfile @@ -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" ] diff --git a/README.md b/README.md index 82ccb08d..459248a2 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,27 @@ video in both the tabs! ![screenshot of chat app](quickstart/public/quickstart.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 use-case examples for the Twilio Video JS SDK. After running the application