Docker config

This commit is contained in:
ChKendel
2025-12-28 10:27:37 +01:00
parent f37c7ed81b
commit 8631ac7c53
3 changed files with 82 additions and 0 deletions

34
Dockerfile.appvideoserver Normal file
View File

@@ -0,0 +1,34 @@
# Use Debian-based Node image
FROM node:lts-bookworm-slim
RUN apt-get update && apt-get install -y \
build-essential cmake git pkg-config \
libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev \
libtbb-dev libjpeg-dev libpng-dev libtiff-dev \
ffmpeg ca-certificates \
python3 python3-dev python3-numpy \
&& rm -rf /var/lib/apt/lists/*
# Clone OpenCV and contrib modules
RUN git clone --branch 4.12.0 https://github.com/opencv/opencv.git /opencv \
&& git clone --branch 4.12.0 https://github.com/opencv/opencv_contrib.git /opencv_contrib
# Build OpenCV with contrib (includes ArUco)
RUN mkdir /opencv/build && cd /opencv/build \
&& cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-D BUILD_opencv_python3=ON \
-D BUILD_EXAMPLES=OFF .. \
&& make -j$(nproc) && make install && ldconfig
# Set working directory for your Node app
WORKDIR /usr/src/app
# Optional: create non-root user
# RUN useradd -m -u 1000 nodeuser
# USER nodeuser
# Node dependencies will be installed later via bind mount or COPY

47
docker-compose.yml Normal file
View File

@@ -0,0 +1,47 @@
version: "3.3"
services:
appvideoserver:
build:
context: .
dockerfile: Dockerfile.appvideoserver
image: appvideoserver:latest
container_name: AppRobotVideo
working_dir: /usr/src/app
# Mount your host folder into the container
volumes:
- .:/usr/src/app
ports:
- "8448:8443"
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- roboticsdriver
init: true
command: >
sh -c "
if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
npm ci || npm install
else
npm install
fi
&& npm start"
environment:
- NODE_ENV=production
- HOST_UID=${UID-1000}
- HOST_GID=${GID-1000}
- DEV0=/dev/video0
- DEV1=/dev/video2
- TARGET_SERVER=wss://host.docker.internal:2095
restart: unless-stopped
networks:
clouds:
ipv4_address: 172.20.0.12
default:
privileged: true
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined

1
run.sh Normal file
View File

@@ -0,0 +1 @@
docker compose -f docker-compose.yaml up -d