diff --git a/build_docker.sh b/build_docker.sh index 87661d59..f7063053 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -17,7 +17,8 @@ mapfile -t BUILD_ARGUMENTS < <(compgen -e | sed -nE '/^(.*)(_proxy|_PROXY)$/{s/^ BUILD_ARGUMENTS+=( "--progress=plain" "--network=host" "--build-arg" "IMAGE_CACHE_REGISTRY=${IMAGE_CACHE_REGISTRY}" ) docker buildx build "${BUILD_ARGUMENTS[@]}" -t "${IMAGE_REGISTRY}/mcm/sdk:${IMAGE_TAG}" -f "${SCRIPT_DIR}/sdk/Dockerfile" "$@" "${SCRIPT_DIR}" -docker buildx build "${BUILD_ARGUMENTS[@]}" -t "${IMAGE_REGISTRY}/mcm/media-proxy:${IMAGE_TAG}" -f "${SCRIPT_DIR}/media-proxy/Dockerfile" "$@" "${SCRIPT_DIR}" +docker buildx build "${BUILD_ARGUMENTS[@]}" -t "${IMAGE_REGISTRY}/mcm/media-proxy:${IMAGE_TAG}" -f "${SCRIPT_DIR}/media-proxy/Dockerfile" "$@" "${SCRIPT_DIR}" --target media-proxy +docker buildx build "${BUILD_ARGUMENTS[@]}" -t "mcm/mesh-agent:${IMAGE_TAG}" -f "${SCRIPT_DIR}/media-proxy/Dockerfile" "$@" "${SCRIPT_DIR}" --target mesh-agent docker buildx build "${BUILD_ARGUMENTS[@]}" --build-arg FFMPEG_VER="7.0" -t "${IMAGE_REGISTRY}/mcm/ffmpeg:${IMAGE_TAG}" -f "${SCRIPT_DIR}/ffmpeg-plugin/Dockerfile" "$@" "${SCRIPT_DIR}" docker buildx build "${BUILD_ARGUMENTS[@]}" --build-arg FFMPEG_VER="6.1" -t "${IMAGE_REGISTRY}/mcm/ffmpeg:6.1-${IMAGE_TAG}" -f "${SCRIPT_DIR}/ffmpeg-plugin/Dockerfile" "$@" "${SCRIPT_DIR}" diff --git a/media-proxy/Dockerfile b/media-proxy/Dockerfile index e3f305bc..e25cb4bb 100644 --- a/media-proxy/Dockerfile +++ b/media-proxy/Dockerfile @@ -135,7 +135,7 @@ RUN ./build.sh "${PREFIX_DIR}" && \ ARG IMAGE_CACHE_REGISTRY ARG IMAGE_NAME -FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} as media-proxy LABEL maintainer="milosz.linkiewicz@intel.com" LABEL org.opencontainers.image.title="Media Communications Mesh Media Proxy" @@ -182,3 +182,52 @@ SHELL ["/bin/bash", "-c"] ENTRYPOINT ["/usr/local/bin/media_proxy"] HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "media_proxy" || exit 1 + + +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} as mesh-agent + +LABEL maintainer="milosz.linkiewicz@intel.com" +LABEL org.opencontainers.image.title="Media Communications Mesh Media Proxy Agent" +LABEL org.opencontainers.image.description="Media Communications Mesh Media Proxy Agent application. Ubuntu 22.04 Docker Container Release Image" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG MCM_DIR="/opt/mcm" +ARG GRPC_DIR="/opt/grpc" +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Warsaw + +ENV KAHAWAI_CFG_PATH="/usr/local/etc/jpegxs.json" +ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib/x86_64-linux-gnu" + +SHELL ["/bin/bash", "-exc"] +RUN apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install -y --no-install-recommends \ + ca-certificates libbsd0 libnuma1 libjson-c5 libpcap0.8 libsdl2-2.0-0 libsdl2-ttf-2.0-0 \ + libssl3 zlib1g libelf1 libcap-ng0 libatomic1 librdmacm1 systemtap sudo \ + librte-net-mlx4-22 librte-net-mlx5-22 libfdt1 ethtool && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + groupadd -g 2110 vfio && \ + groupadd -g 1001 imtl && \ + useradd -m -s /bin/bash -G vfio,imtl -u 1002 mcm && \ + usermod -aG sudo mcm + +COPY --chown=mcm --from=builder /install / + +RUN ldconfig && \ + apt-get purge -y '.*sound.*' '.*systemtap.*' '.*libdrm.*' '.*vorbis.*' '.*wayland.*' '.*x11.*' '.*python.*' '.*readline.*' '.*avahi.*' '^libx[a-w,y-z].*' make media-types libopus0 \ + libexpat1 libflac8 libfreetype6 libsndfile1 libgbm1 libglib2.0-0 libgraphite2-3 libharfbuzz0b libogg0 libpulse0 libmpdec3 libnspr4 libpng16-16 \ + xkb-data distro-info-data libdw1 libbrotli1 libdecor-0-0 libxxf86vm1 libapparmor1 libasyncns0 libnss3 libsqlite3-0 lsb-release +USER mcm +WORKDIR /opt/mcm/ + +EXPOSE 8100/tcp 50051/tcp + +CMD ["-h"] +SHELL ["/bin/bash", "-c"] +ENTRYPOINT ["/usr/local/bin/mesh-agent"] + +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "mesh-agent" || exit 1 \ No newline at end of file diff --git a/media-proxy/README.md b/media-proxy/README.md index 38696544..3250f747 100644 --- a/media-proxy/README.md +++ b/media-proxy/README.md @@ -71,7 +71,7 @@ Since Media Proxy depends on the MTL library, so you need to [setup MTL](https:/ ```bash cd Media-Communications-Mesh/media-proxy -docker build -t mcm/media-proxy . +docker build --target media-proxy -t mcm/media-proxy . ``` 2. Run the Docker Container @@ -127,6 +127,21 @@ kubectl get daemonsets.apps -n mcm If all commands are executed successfully, you will see the Media Proxy deployed as a K8s DaemonSet to the worker node (labeled with "mcm.intel.com/role=worker"). +## Docker for mcm/mesh-agent + +1. Build Docker Image + +```bash +cd Media-Communications-Mesh/media-proxy +docker build --target mesh-agent -t mcm/mesh-agent . +``` + +2. Run the Docker Container + +```bash +docker run --privileged -p 8100:8100 -p 50051:50051 mcm/mesh-agent:latest +``` + ## Known Issues - There is a bug with the default docker.io package installation (version 20.10.25-0ubuntu1~22.04.2) with Ubuntu 22.04.3 LTS. The [`USER` command](https://github.com/moby/moby/issues/46355) and [`chown` command](https://github.com/moby/moby/issues/46161) do not work as expected. It is preferred to install the `docker-ce` package, following an [instruction from Docker Docs](https://docs.docker.com/engine/install/ubuntu/).