Skip to content

Commit e212433

Browse files
authored
Ci: Update gtest-bare-metal.yml (#1195)
Update gtest-bare-metal.yml Try to minimize possible issue inject points Signed-off-by: Milosz Linkiewicz <[email protected]>
1 parent 0e1bcb1 commit e212433

File tree

3 files changed

+139
-66
lines changed

3 files changed

+139
-66
lines changed

.github/path_filters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ linux_gtest: &linux_gtest
88
- .github/workflows/ubuntu_build_with_gtest.yml
99
- '.github/workflows/upl*'
1010
- 'patches/ice_drv/**'
11-
- *ubuntu_build
11+
- '*src'
12+
- '*build'
1213

1314
ice_build: &ice_build
1415
- .github/workflows/base_build.yml
@@ -27,7 +28,6 @@ rust_build: &rust_hooks_build
2728
- .github/workflows/base_build.yml
2829
- 'rust/**'
2930

30-
3131
python_build: &python_hooks_build
3232
- .github/workflows/base_build.yml
3333
- 'python/**'

.github/workflows/docker_build.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414
permissions:
1515
contents: read
1616

17+
env:
18+
DOCKER_IMAGE_TAG: "${{ github.sha }}"
19+
DOCKER_IMAGE_NAME: "mtl"
20+
DOCKER_REGISTRY: "ghcr.io"
21+
DOCKER_REGISTRY_PREFIX: "openvisualcloud/media-transport-library"
22+
DOCKER_REGISTRY_LOGIN: "${{ github.repository == 'openvisualcloud/media-transport-library' }}"
23+
1724
jobs:
1825
changes:
1926
runs-on: ubuntu-latest
@@ -37,7 +44,7 @@ jobs:
3744
timeout-minutes: 120
3845
permissions:
3946
contents: read
40-
47+
packages: write
4148
steps:
4249
- name: Harden Runner
4350
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
@@ -50,17 +57,27 @@ jobs:
5057
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
5158
with:
5259
buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
53-
platforms: "linux/amd64"
60+
platforms: "linux/amd64/v4"
5461
driver-opts: memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000,env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000
5562

63+
- name: Login to Docker Container Registry
64+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
65+
if: ${{ env.DOCKER_REGISTRY_LOGIN == 'true' }}
66+
continue-on-error: true
67+
with:
68+
registry: "${{ env.DOCKER_REGISTRY }}"
69+
username: "${{ github.repository_owner }}"
70+
password: "${{ secrets.GITHUB_TOKEN }}"
71+
5672
- name: Build image
5773
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
5874
with:
59-
push: false
60-
file: docker/ubuntu.dockerfile
61-
tags: mtl:latest
62-
63-
75+
push: "${{ env.DOCKER_REGISTRY_LOGIN == 'true' }}"
76+
context: "${{ github.workspace }}"
77+
file: "${{ github.workspace }}/docker/ubuntu.dockerfile"
78+
tags: "${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
79+
cache-from: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}"
80+
cache-to: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }},mode=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'max' || 'min' }}"
6481

6582
manager-docker-build:
6683
needs: changes
@@ -69,31 +86,47 @@ jobs:
6986
timeout-minutes: 120
7087
permissions:
7188
contents: read
72-
89+
packages: write
90+
env:
91+
DOCKER_IMAGE_NAME: mtl-manager
7392
steps:
7493
- name: Harden Runner
7594
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
7695
with:
7796
egress-policy: audit
97+
7898
- name: Checkout repository
7999
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
80100

81101
- name: Set up Docker Buildx
82-
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
102+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
83103
with:
84104
buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
85-
platforms: "linux/amd64"
105+
platforms: "linux/amd64/v4"
86106
driver-opts: memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000,env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000
87107

88108
- name: Cache version from version file
89109
id: version
90110
working-directory: ${{ github.workspace }}
91111
run: echo "VERSION=$(cat VERSION)">> "$GITHUB_OUTPUT"
92112

113+
- name: Login to Docker Container Registry
114+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
115+
if: ${{ env.DOCKER_REGISTRY_LOGIN == 'true' }}
116+
continue-on-error: true
117+
with:
118+
registry: "${{ env.DOCKER_REGISTRY }}"
119+
username: "${{ github.repository_owner }}"
120+
password: "${{ secrets.GITHUB_TOKEN }}"
121+
93122
- name: Build manager image
94123
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
95124
with:
96-
push: false
97-
context: ${{ github.workspace }}/manager
98-
tags: mtl-manager:latest
99-
build-args: VERSION=${{ steps.version.outputs.VERSION }}
125+
push: "${{ env.DOCKER_REGISTRY_LOGIN == 'true' }}"
126+
context: "${{ github.workspace }}/manager"
127+
file: "${{ github.workspace }}/manager/Dockerfile"
128+
tags: "${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
129+
cache-from: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}"
130+
cache-to: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }},mode=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'max' || 'min' }}"
131+
build-args: VERSION=${{ steps.version.outputs.VERSION }}
132+

docker/ubuntu.dockerfile

Lines changed: 90 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,124 @@
1-
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright 2023 Intel Corporation
1+
# syntax=docker/dockerfile:1
32

4-
# NOTE: This Dockerfile is intended for development purposes only.
5-
# It has been tested for functionality, but not for security.
6-
# Please review and modify as necessary before using in a production environment.
3+
# Copyright (c) 2025 Intel Corporation.
4+
# SPDX-License-Identifier: BSD-3-Clause
75

8-
# Ubuntu 22.04, build stage
9-
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS builder
6+
# Ubuntu 22.04, builder stage
7+
ARG IMAGE_CACHE_REGISTRY=docker.io
8+
FROM "${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37" AS builder
109

1110
1211

12+
ARG NPROC=20
13+
ARG DPDK_VER=25.03
14+
ARG PREFIX_PATH=/opt/intel
15+
ARG MTL_REPO=${PREFIX_PATH}/mtl
16+
ENV XDP_REPO=${PREFIX_PATH}/xdp
17+
ENV DPDK_REPO=${PREFIX_PATH}/dpdk
18+
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
19+
ENV DEBIAN_FRONTEND="noninteractive"
20+
ENV TZ="Europe/Warsaw"
21+
22+
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
23+
1324
# Install build dependencies and debug tools
25+
WORKDIR "${DPDK_REPO}"
26+
RUN apt-get update -y && \
27+
apt-get upgrade -y && \
28+
apt-get install -y --no-install-recommends ca-certificates sudo curl unzip apt-transport-https apt-utils python3-dev && \
29+
apt-get autoremove -y && \
30+
rm -rf /var/lib/apt/lists/* && \
31+
curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3 && \
32+
python3 -m pip --no-cache-dir install --upgrade pip setuptools
33+
34+
WORKDIR "${MTL_REPO}"
1435
RUN apt-get update -y && \
15-
apt-get install -y --no-install-recommends systemtap-sdt-dev && \
16-
apt-get install -y --no-install-recommends git build-essential meson python3 python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev ca-certificates && \
17-
apt-get install -y --no-install-recommends m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib && \
36+
apt-get install -y --no-install-recommends git build-essential python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev && \
37+
apt-get install -y --no-install-recommends m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib systemtap-sdt-dev && \
38+
apt-get autoremove -y && \
1839
apt-get clean && \
19-
rm -rf /var/lib/apt/lists/*
20-
21-
ENV MTL_REPO=Media-Transport-Library
22-
ENV DPDK_VER=25.03
23-
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
40+
rm -rf /var/lib/apt/lists/* && \
41+
python3 -m pip --no-cache-dir install meson ninja
2442

25-
COPY . $MTL_REPO
43+
COPY . "${MTL_REPO}"
2644

2745
# Clone DPDK and xdp-tools repo
28-
RUN git clone https://github.com/DPDK/dpdk.git && \
29-
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git
46+
WORKDIR "${XDP_REPO}"
47+
RUN git clone https://github.com/DPDK/dpdk.git "${DPDK_REPO}" && \
48+
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git "${XDP_REPO}"
3049

3150
# Build DPDK with Media-Transport-Library patches
32-
WORKDIR /dpdk
51+
WORKDIR "${DPDK_REPO}"
3352
RUN git checkout v$DPDK_VER && \
3453
git switch -c v$DPDK_VER && \
3554
git config --global user.email "[email protected]" && \
3655
git config --global user.name "Your Name" && \
37-
git am ../$MTL_REPO/patches/dpdk/$DPDK_VER/*.patch && \
56+
git am "${MTL_REPO}/patches/dpdk/${DPDK_VER}/"*.patch && \
3857
meson setup build && \
39-
meson install -C build && \
40-
DESTDIR=/install meson install -C build
58+
ninja -C build && \
59+
ninja -C build install && \
60+
DESTDIR=/install ninja -C build install
4161

4262
# Build the xdp-tools project
43-
WORKDIR /xdp-tools
44-
RUN ./configure && make &&\
45-
make install && \
46-
DESTDIR=/install make install
47-
WORKDIR /xdp-tools/lib/libbpf/src
48-
RUN make install && \
49-
DESTDIR=/install make install
63+
WORKDIR "${XDP_REPO}"
64+
RUN ./configure && \
65+
make -j${NPROC:-$(nproc)} && \
66+
make -j${NPROC:-8} install && \
67+
DESTDIR=/install make -j${NPROC:-8} install && \
68+
mkdir -p "${XDP_REPO}/lib/libbpf/src" && \
69+
make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-$(nproc)} && \
70+
make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-8} install && \
71+
DESTDIR=/install make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-8} install
5072

5173
# Build MTL
52-
WORKDIR /$MTL_REPO
53-
RUN ./build.sh && \
54-
DESTDIR=/install meson install -C build && \
55-
setcap 'cap_net_raw+ep' ./tests/tools/RxTxApp/build/RxTxApp
56-
57-
# Ubuntu 22.04, runtime stage
58-
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS final
59-
60-
74+
WORKDIR "${MTL_REPO}"
75+
RUN "${MTL_REPO}/build.sh" && \
76+
ninja -C "${MTL_REPO}/build" && \
77+
ninja -C "${MTL_REPO}/build" install && \
78+
DESTDIR=/install ninja -C "${MTL_REPO}/build" install && \
79+
setcap 'cap_net_raw+ep' "${MTL_REPO}/tests/tools/RxTxApp/build/RxTxApp"
80+
81+
# Ubuntu 22.04, runtime/final stage
82+
ARG MTL_REPO
83+
ARG IMAGE_CACHE_REGISTRY
84+
FROM "${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37" AS final
85+
86+
LABEL org.opencontainers.image.authors="[email protected],[email protected],[email protected]"
87+
LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Media-Transport-Library"
88+
LABEL org.opencontainers.image.title="Intel® Media Transport Library"
89+
LABEL org.opencontainers.image.description="Intel® Media Transport Library (MTL), a real-time media transport(DPDK, AF_XDP, RDMA) stack for both raw and compressed video based on COTS hardware"
90+
LABEL org.opencontainers.image.documentation="https://openvisualcloud.github.io/Media-Transport-Library/README.html"
91+
LABEL org.opencontainers.image.version="1.26.0"
92+
LABEL org.opencontainers.image.vendor="Intel® Corporation"
93+
LABEL org.opencontainers.image.licenses="BSD 3-Clause License"
94+
95+
ARG PREFIX_PATH=/opt/intel
96+
ARG MTL_REPO=${PREFIX_PATH}/mtl
97+
ENV DEBIAN_FRONTEND="noninteractive"
98+
ENV TZ="Europe/Warsaw"
99+
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
61100

62101
# Install runtime dependencies
63-
RUN apt-get update -y && \
102+
WORKDIR /home/imtl/
103+
RUN apt-get clean -y && rm -rf /var/lib/apt/lists/* && \
104+
apt-get update -y && \
105+
apt-get install -y --no-install-recommends ca-certificates sudo curl unzip && \
64106
apt-get install -y --no-install-recommends libnuma1 libjson-c5 libpcap0.8 libsdl2-2.0-0 libsdl2-ttf-2.0-0 libssl3 zlib1g libelf1 libcap-ng0 libatomic1 && \
107+
apt-get autoremove -y && \
65108
apt-get clean && \
66-
rm -rf /var/lib/apt/lists/*
67-
68-
# Add user: imtl(1001) with group vfio(2110)
69-
RUN groupadd -g 2110 vfio && \
70-
useradd -m -G vfio -u 1001 imtl
109+
rm -rf /var/lib/apt/lists/* && \
110+
echo "Add user: imtl(20001) with group vfio(2110)" && \
111+
groupadd -g 2110 vfio && \
112+
useradd -m -G vfio,root,sudo -u 20001 imtl
71113

72114
# Copy libraries and binaries
73115
COPY --chown=imtl --from=builder /install /
74-
COPY --chown=imtl --from=builder /Media-Transport-Library/build /home/imtl
75-
COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/build/RxTxApp /home/imtl/RxTxApp
76-
COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/script /home/imtl/scripts
77-
78-
WORKDIR /home/imtl/
116+
COPY --chown=imtl --from=builder "${MTL_REPO}/build" "/home/imtl"
117+
COPY --chown=imtl --from=builder "${MTL_REPO}/tests/tools/RxTxApp/build/RxTxApp" "/home/imtl/RxTxApp"
118+
COPY --chown=imtl --from=builder "${MTL_REPO}/tests/tools/RxTxApp/script" "/home/imtl/scripts"
79119

80-
# ldconfig
81120
RUN ldconfig
121+
SHELL ["/bin/bash", "-c"]
82122

83123
USER imtl
84124
HEALTHCHECK --interval=30s --timeout=5s CMD true || exit 1

0 commit comments

Comments
 (0)