Skip to content

Commit

Permalink
Merge pull request iizukanao#61 from TheNotary/dockerization
Browse files Browse the repository at this point in the history
adds docker deployment option
  • Loading branch information
iizukanao authored Jan 21, 2017
2 parents be84c63 + 9ba745f commit ecbf5bc
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:4-onbuild

################
# App Deps #
################

RUN mkdir /app
WORKDIR /app

# TODO:
# Copy over your application stuff required to load up
# dependencies and then install those dependencies

ADD package.json /app/package.json
RUN npm install -d
RUN npm install -g coffee-script


################
# App Source #
################

# Copy over your apps sourcecode in this section
COPY . /app/


#############
# Conclude #
#############

COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod +x /sbin/entrypoint.sh
RUN echo ". /sbin/entrypoint.sh" > /root/.bash_history

ENTRYPOINT ["/sbin/entrypoint.sh"]
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DOCKER_IMAGE_NAME = node-rtsp-rtmp-server

build:
docker build -t ${USER}/${DOCKER_IMAGE_NAME} .

# If you have to configure volumes, do that from here
# configure:

run:
(docker start ${DOCKER_IMAGE_NAME}) || \
docker run \
-p 80:80 -p 1935:1935 \
--name ${DOCKER_IMAGE_NAME} -d ${USER}/${DOCKER_IMAGE_NAME}

console:
docker run -it \
-p 80:80 -p 1935:1935 \
-e an_env_var=${HIDDEN_ENV} \
${USER}/${DOCKER_IMAGE_NAME} bash

.PHONY: build
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- Supports RTSP, RTMP/RTMPE/RTMPT/RTMPTE, and HTTP.
- Supports only H.264 video and AAC audio (AAC-LC, HE-AAC v1/v2).

### Installation
### Installation without Docker

$ git clone https://github.com/iizukanao/node-rtsp-rtmp-server.git
$ cd node-rtsp-rtmp-server
Expand All @@ -26,6 +26,15 @@ or use Node.js directly:

If both `serverPort` and `rtmpServerPort` are above 1023 in config.coffee, you can omit `sudo`.

### Docker Deploy Method

If you would prefer building and executing this code in a docker container, you can do so by first building the container and then running it.

$ make build
$ make console

You may also want to use just `make run` to run the container as a daemon. If you fiddle with the ports, you'll need to update the values in the Makefile as well to expose the desired ports to your system.

### Serving MP4 files as recorded streams

MP4 files in `file` directory will be accessible at either:
Expand Down
15 changes: 15 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

# Boot any servers you need to
bash -l -c "coffee /app/server.coffee &"


# Spawn bash if we're booting in console mode
if [ "$1" = 'bash' ]; then
/bin/bash
exit
fi

# This line keeps the container alive
tail -f /var/log/dmesg

0 comments on commit ecbf5bc

Please sign in to comment.