Created
April 8, 2023 19:32
-
-
Save ilio/8cc39b6599088a7ad8d791551ec91124 to your computer and use it in GitHub Desktop.
qnap QBoat Sunny web camera rtsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian | |
RUN apt update && apt install -y tzdata; \ | |
apt clean; | |
# sshd | |
RUN mkdir /var/run/sshd; \ | |
apt install -y openssh-server; \ | |
sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config; \ | |
sed -i 's/^\(UsePAM yes\)/# \1/' /etc/ssh/sshd_config; \ | |
apt clean; | |
RUN apt install -y build-essential libevent-dev libjpeg-dev libbsd-dev v4l-utils usbutils \ | |
hwinfo git sudo curl nano ffmpeg; | |
# RUN cd /root; \ | |
# git clone --depth=1 https://github.com/pikvm/ustreamer; \ | |
# cd ustreamer/; \ | |
# make; \ | |
RUN echo 'install mediamtx'; \ | |
cd /root; \ | |
curl -OJLv https://github.com/aler9/mediamtx/releases/download/v0.22.0/mediamtx_v0.22.0_linux_armv7.tar.gz; \ | |
ls -la; \ | |
mkdir mediamtx; \ | |
tar -C mediamtx -xf mediamtx_v0.22.0_linux_armv7.tar.gz; \ | |
{ \ | |
echo ' cam:'; \ | |
echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -pix_fmt yuv420p -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \ | |
echo ' runOnInitRestart: yes'; \ | |
} >> mediamtx/mediamtx.yml; \ | |
sed -i 's/^api: no/api: yes/' mediamtx/mediamtx.yml; \ | |
sed -i 's/^apiAddress: 127.0.0.0:9997/apiAddress: :9997/' mediamtx/mediamtx.yml; | |
# entrypoint | |
RUN { \ | |
echo '#!/bin/bash -eu'; \ | |
echo 'ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime'; \ | |
echo 'echo "root:${ROOT_PASSWORD}" | chpasswd'; \ | |
echo 'v4l2-ctl --set-fmt-video width=1920,height=1080,pixelformat=MJPG'; \ | |
echo '/root/mediamtx/mediamtx /root/mediamtx/mediamtx.yml &'; \ | |
echo 'exec "$@"'; \ | |
} > /usr/local/bin/entry_point.sh; \ | |
chmod +x /usr/local/bin/entry_point.sh; | |
ENV TZ Asia/Jerusalem | |
ENV ROOT_PASSWORD root | |
EXPOSE 22 | |
EXPOSE 8080 | |
EXPOSE 8554 | |
EXPOSE 8000 | |
EXPOSE 8001 | |
EXPOSE 1935 | |
EXPOSE 8888 | |
EXPOSE 8889 | |
EXPOSE 9997 | |
ENTRYPOINT ["entry_point.sh"] | |
CMD ["/usr/sbin/sshd", "-D", "-e"] |
FROM debian
RUN apt update && apt install -y tzdata; \
apt clean;
# sshd
RUN mkdir /var/run/sshd; \
apt install -y openssh-server; \
sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config; \
sed -i 's/^\(UsePAM yes\)/# \1/' /etc/ssh/sshd_config; \
apt clean;
RUN apt install -y build-essential libevent-dev libjpeg-dev libbsd-dev v4l-utils usbutils \
hwinfo git sudo curl nano ffmpeg lsof wget;
RUN cd /root; \
git clone --depth=1 https://github.com/pikvm/ustreamer; \
cd ustreamer; \
make; \
cd /root; \
git clone https://github.com/Klipper3d/klipper; \
cd klipper/scripts; \
sed -i 's/\(exit -1\)/#\1/' install-debian.sh; \
sed -i 's/\(install_script$\)/#\1/' install-debian.sh; \
sed -i 's/\(start_software$\)/#\1/' install-debian.sh; \
./install-debian.sh;
# echo 'install mediamtx'; \
# cd /root; \
# curl -OJLv https://github.com/aler9/mediamtx/releases/download/v0.22.0/mediamtx_v0.22.0_linux_armv7.tar.gz; \
# ls -la; \
# mkdir mediamtx; \
# tar -C mediamtx -xf mediamtx_v0.22.0_linux_armv7.tar.gz; \
# if [ ! -f mediamtx/mediamtx ]; then echo "mediamtx not found!"; exit 1; fi; \
# { \
# echo ' cam:'; \
## echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -pix_fmt yuv420p -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \
# echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \
# echo ' runOnInitRestart: yes'; \
# } >> mediamtx/mediamtx.yml; \
# sed -i 's/^api: no/api: yes/' mediamtx/mediamtx.yml; \
# sed -i 's/^apiAddress: 127.0.0.1:9997/apiAddress: :9997/' mediamtx/mediamtx.yml; \
# ls -la;
# entrypoint
RUN { \
echo '#!/bin/bash -eu'; \
echo 'ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime'; \
echo 'echo "root:${ROOT_PASSWORD}" | chpasswd'; \
# echo 'v4l2-ctl --set-fmt-video width=1920,height=1080,pixelformat=MJPG'; \
# echo 'v4l2-ctl --get-fmt-video'; \
# echo '/root/mediamtx/mediamtx /root/mediamtx/mediamtx.yml &'; \
echo '/root/ustreamer/ustreamer -m MJPEG -r 1920x1080 -c HW --host=0.0.0.0 &'; \
echo 'exec "$@"'; \
} > /usr/local/bin/entry_point.sh; \
chmod +x /usr/local/bin/entry_point.sh;
ENV TZ Asia/Jerusalem
ENV ROOT_PASSWORD root
EXPOSE 22
EXPOSE 8080
# EXPOSE 8554
# EXPOSE 8000
# EXPOSE 8001
# EXPOSE 1935
# EXPOSE 8888
# EXPOSE 8889
# EXPOSE 9997
ENTRYPOINT ["entry_point.sh"]
CMD ["/usr/sbin/sshd", "-D", "-e"]
read serial data from marlin
sudo chmod a+rw /dev/ttyUSB0
apt install picocom
picocom -b 250000 /dev/ttyUSB0 --imap lfcrlf
make flash FLASH_DEVICE=/dev/ttyUSB0
make flash FLASH_DEVICE=/dev/cu.usbserial-110
FROM debian
RUN apt update; apt install -y tzdata git sudo curl nano python3; \
apt clean;
RUN cd root/; \
git clone https://github.com/Klipper3d/klipper; \
cd klipper/scripts/; \
sed -i 's/\(exit -1\)/#\1/' install-debian.sh; \
sed -i 's/\(install_script$\)/#\1/' install-debian.sh; \
sed -i 's/\(start_software$\)/#\1/' install-debian.sh; \
sed -i 's/python-dev/python-dev-is-python3/g' install-debian.sh; \
cd ..; \
./scripts/install-debian.sh; \
cd ..;
docker image build -t debian-klipper:latest .
docker run -v /dev/cu.usbserial-110:/dev/cu.usbserial-110 --device-cgroup-rule='c *:* rmw' --privileged -it -p 8022:22 debian-klipper /bin/bash -c "cd /root/klipper && /bin/bash"
cp ~/klipper/config/generic-ramps.cfg ~/printer.cfg
nano ~/printer.cfg
[mcu]
serial: /dev/ttyUSB0
[display]
lcd_type: st7920
cs_pin: EXP1_4
sclk_pin: EXP1_5
sid_pin: EXP1_3
encoder_pins: ^EXP2_3, ^EXP2_5
click_pin: ^!EXP1_2
#kill_pin: ^!EXP2_8
[output_pin beeper]
pin: EXP1_1
ls /dev/
cd klipper/
pip install -r ./scripts/klippy-requirements.txt
python3 ./klippy/klippy.py ~/printer.cfg
FROM debian
RUN apt update && apt install -y tzdata; \
apt clean;
# sshd
RUN mkdir /var/run/sshd; \
apt install -y openssh-server; \
sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config; \
sed -i 's/^\(UsePAM yes\)/# \1/' /etc/ssh/sshd_config; \
apt clean;
RUN apt install -y build-essential libevent-dev libjpeg-dev libbsd-dev v4l-utils usbutils \
hwinfo git sudo curl nano ffmpeg lsof wget;
RUN cd /root; \
git clone --depth=1 https://github.com/pikvm/ustreamer; \
cd ustreamer; \
make; \
cd /root; \
git clone https://github.com/Klipper3d/klipper; \
cd klipper/scripts; \
sed -i 's/\(exit -1\)/#\1/' install-debian.sh; \
sed -i 's/\(install_script$\)/#\1/' install-debian.sh; \
sed -i 's/\(start_software$\)/#\1/' install-debian.sh; \
./install-debian.sh;
# echo 'install mediamtx'; \
# cd /root; \
# curl -OJLv https://github.com/aler9/mediamtx/releases/download/v0.22.0/mediamtx_v0.22.0_linux_armv7.tar.gz; \
# ls -la; \
# mkdir mediamtx; \
# tar -C mediamtx -xf mediamtx_v0.22.0_linux_armv7.tar.gz; \
# if [ ! -f mediamtx/mediamtx ]; then echo "mediamtx not found!"; exit 1; fi; \
# { \
# echo ' cam:'; \
## echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -pix_fmt yuv420p -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \
# echo ' runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH'; \
# echo ' runOnInitRestart: yes'; \
# } >> mediamtx/mediamtx.yml; \
# sed -i 's/^api: no/api: yes/' mediamtx/mediamtx.yml; \
# sed -i 's/^apiAddress: 127.0.0.1:9997/apiAddress: :9997/' mediamtx/mediamtx.yml; \
# ls -la;
# entrypoint
RUN { \
echo '#!/bin/bash -eu'; \
echo 'ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime'; \
echo 'echo "root:${ROOT_PASSWORD}" | chpasswd'; \
# echo 'v4l2-ctl --set-fmt-video width=1920,height=1080,pixelformat=MJPG'; \
# echo 'v4l2-ctl --get-fmt-video'; \
# echo '/root/mediamtx/mediamtx /root/mediamtx/mediamtx.yml &'; \
# echo '/root/ustreamer/ustreamer -m MJPEG -r 1920x1080 -c HW --host=0.0.0.0 &'; \
echo 'python3 /root/klipper/klippy/klippy.py /root/printer.cfg -l /tmp/klippy.log -a /tmp/klippy_uds &'; \
echo 'exec "$@"'; \
} > /usr/local/bin/entry_point.sh; \
chmod +x /usr/local/bin/entry_point.sh;
ENV TZ Asia/Jerusalem
ENV ROOT_PASSWORD root
EXPOSE 22
EXPOSE 8080
# EXPOSE 8554
# EXPOSE 8000
# EXPOSE 8001
# EXPOSE 1935
# EXPOSE 8888
# EXPOSE 8889
# EXPOSE 9997
ENTRYPOINT ["entry_point.sh"]
CMD ["/usr/sbin/sshd", "-D", "-e"]
#!/bin/bash -eu
ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime
echo "root:${ROOT_PASSWORD}" | chpasswd
#/root/ustreamer/ustreamer -m MJPEG -r 1920x1080 -c HW --host=0.0.0.0 &
python3 /root/klipper/klippy/klippy.py /root/printer_data/printer.cfg -l /root/printer_data/klippy.log -a /tmp/klippy_uds &
/root/moonraker-env/bin/python /root/moonraker/moonraker/moonraker.py -d /root/printer_data -c /root/klipper_config/moonraker.conf -l /root/klipper_logs/moonraker.log -v -g &
exec "$@"
python3 /root/klipper/klippy/klippy.py /root/printer_data/config/printer.cfg -l /root/printer_data/logs/klippy.log -I /root/printer_data/comms/klippy.serial -a /root/printer_data/comms/klippy.sock
/root/moonraker-env/bin/python /root/moonraker/moonraker/moonraker.py -d /root/printer_data -c /root/printer_data/config/moonraker.conf -l /root/printer_data/logs/moonraker.log -v -g &
apt install iproute2
ip
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker run -v /dev:/dev --device-cgroup-rule='c 189:* rmw' --privileged -d -p 8022:22 deb_ssh_mtx