Sign inSign up

onlysea212/shinobi

By onlysea212

Updated almost 5 years ago

Shinobi CCTV: https://shinobi.video/

Image
0

1.2K

onlysea212/shinobi repository overview

This image will be used for both camera.js and cron.js To run camera.js

docker run onlysea212/shinobi

To run cron.js

docker run onlysea212/shinobi cron.js

Dockerfile:

FROM alpine:3.12 as build

RUN apk -U add \
        nodejs \
        npm \
        git

WORKDIR /app

RUN git clone https://gitlab.com/Shinobi-Systems/Shinobi

RUN cd Shinobi \
  && npm i npm@latest -g \
  && npm install --unsafe-perm 

FROM alpine:3.12 as final

RUN apk -U add \
        ffmpeg \
        nodejs \
        tzdata

WORKDIR /app

RUN adduser -h /app -D -H shinobi \
  && chown shinobi:shinobi /app

COPY --from=build --chown=shinobi:shinobi /app/Shinobi .

COPY --chown=shinobi:shinobi docker-entrypoint.sh .

RUN chmod +x docker-entrypoint.sh

USER shinobi

ENTRYPOINT ["/app/docker-entrypoint.sh"]

#CMD ["node", "camera.js"]
CMD ["camera.js"]

docker-entrypoint.sh:

#!/bin/sh
cronKey="$(head -c 1024 < /dev/urandom | sha256sum | awk '{print substr($1,1,29)}')"
if [ -e "/config/conf.json" ]; then
    cp /config/conf.json conf.json
elif [ ! -e "./conf.json" ]; then
    cp conf.sample.json conf.json
fi

sed -i -e 's/change_this_to_something_very_random__just_anything_other_than_this/'"$cronKey"'/g' conf.json

if [ -e "/config/super.json" ]; then
    cp /config/super.json super.json
elif [ ! -e "./super.json" ]; then
    cp super.sample.json super.json
fi

if [ -e "/config/init.extension.sh" ]; then
    echo "Running extension init file ..."
    ( sh /config/init.extension.sh )
fi

# Execute Command
echo "Starting Shinobi ..."
#exec "$@"
exec /usr/bin/node --unhandled-rejections=strict $@

Tag summary

Content type

Image

Digest

Size

197.2 MB

Last updated

almost 5 years ago

docker pull onlysea212/shinobi