diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..869116e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,84 @@ +FROM lsiobase/ffmpeg:bin as binstage +FROM lsiobase/cloud9:files as c9files +FROM lsiobase/ubuntu:bionic + +# Add files from stages +COPY --from=binstage / / +COPY --from=c9files /buildout/ / + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG FFMPEGWEB_COMMIT +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="thelamer" + +# hardware env +ENV \ + LIBVA_DRIVERS_PATH="/usr/lib/x86_64-linux-gnu/dri" \ + NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" + +RUN \ + echo "**** install build-deps ffmpeg-web ****" && \ + apt-get update && \ + apt-get install -y \ + python3-pip && \ + echo "**** install runtime ffmpeg-web ****" && \ + apt-get install -y \ + python3 && \ + echo "**** install runtime ffmpeg ****" && \ + apt-get install -y \ + i965-va-driver \ + libexpat1 \ + libgl1-mesa-dri \ + libglib2.0-0 \ + libgomp1 \ + libharfbuzz0b \ + libv4l-0 \ + libx11-6 \ + libxcb1 \ + libxext6 \ + libxml2 && \ + echo "**** install stuff specific to the dev container ****" && \ + apt-get install -y \ + git \ + npm && \ + npm install -g nodemon && \ + echo "**** install web app from git ****" && \ + if [ -z ${FFMPEGWEB_COMMIT+x} ]; then \ + FFMPEGWEB_COMMIT=$(curl -sX GET https://api.github.com/repos/linuxserver/docker-ffmpeg/commits/web \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ + fi && \ + git clone \ + https://github.com/linuxserver/docker-ffmpeg.git + /app/ffmpeg-web && \ + git \ + --git-dir /app/ffmpeg-web/.git \ + checkout -f ${FFMPEGWEB_COMMIT} && \ + pip3 install \ + -r /app/ffmpeg-web/requirements.txt && \ + echo "**** permissions ****" && \ + mkdir -p /applogs/ && \ + chown -R abc:abc \ + /app/ffmpeg-web \ + /applogs && \ + /c9sdk/build/standalone \ + /c9bins + usermod -aG sudo \ + abc && \ + chsh abc -s /bin/bash && \ + sed -e 's/%sudo ALL=(ALL:ALL) ALL/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' \ + -i /etc/sudoers && \ + sed -e 's/^wheel:\(.*\)/wheel:\1,abc/g' -i /etc/group && \ + echo "**** clean up ****" && \ + rm -rf \ + /root \ + /var/lib/apt/lists/* \ + /var/tmp/* && + mkdir /root + +# add local files +COPY /root / + +# ports +EXPOSE 8787 8000 diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/public/index.html @@ -0,0 +1 @@ +Hello World diff --git a/reqirements.txt b/reqirements.txt new file mode 100644 index 0000000..eaf43dd --- /dev/null +++ b/reqirements.txt @@ -0,0 +1,2 @@ +aiohttp +python-socketio diff --git a/root/etc/services.d/c9/run b/root/etc/services.d/c9/run new file mode 100644 index 0000000..c558c1f --- /dev/null +++ b/root/etc/services.d/c9/run @@ -0,0 +1,6 @@ +#!/usr/bin/with-contenv bash + +cd /c9sdk +HOME=/c9bins exec \ + s6-setuidgid abc \ + /c9bins/.c9/node/bin/node server.js --listen 0.0.0.0 -p 8000 -w /app/ffmpeg-web -a : diff --git a/root/etc/services.d/web/run b/root/etc/services.d/web/run new file mode 100644 index 0000000..7224b8d --- /dev/null +++ b/root/etc/services.d/web/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +# Run App in development mode +cd /app/ffmpeg-web +exec \ + s6-setuidgid abc nodemon \ + --exec python3 server.py > /applogs/app.log diff --git a/server.py b/server.py new file mode 100644 index 0000000..8ee09a4 --- /dev/null +++ b/server.py @@ -0,0 +1,15 @@ +from aiohttp import web +import socketio + +sio = socketio.AsyncServer() +app = web.Application() +sio.attach(app) + +async def index(request): + with open('./public/index.html') as f: + return web.Response(text=f.read(), content_type='text/html') + +app.router.add_get('/', index) + +if __name__ == '__main__': + web.run_app(app, port=8787)