-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathDockerfile
64 lines (48 loc) · 1.96 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2023 Intel Corporation
# NOTE: This Dockerfile is intended for development purposes only.
# It has been tested for functionality, but not for security.
# Please review and modify as necessary before using in a production environment.
# Build stage, ubuntu 22.04
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS builder
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
ARG VERSION
# Install build dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends git build-essential pkg-config m4 clang llvm zlib1g-dev libelf-dev libpcap-dev libcap-ng-dev meson gcc-multilib ca-certificates
# Clone and build the xdp-tools project
RUN git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git
WORKDIR /xdp-tools
RUN ./configure && make && \
make install && \
DESTDIR=/install make install
WORKDIR /xdp-tools/lib/libbpf/src
RUN make install && \
DESTDIR=/install make install
COPY . /manager
RUN \
if [ -z "${VERSION}" ]; then \
VERSION="0.0.1.DOCKER"; \
fi; \
echo "$VERSION" > /VERSION
# Build the MTL Manager
WORKDIR /manager
RUN meson setup build && \
DESTDIR=/install meson install -C build
# Runtime stage, ubuntu 22.04
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37
# Install runtime dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends ethtool libelf1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Add user: imtl(1001) with group vfio(2110)
RUN groupadd -g 2110 vfio && \
useradd -m -G vfio -u 1001 imtl
# Copy the necessary binaries and libraries from the builder
COPY --chown=imtl --from=builder /install /
RUN ldconfig
USER imtl
HEALTHCHECK --interval=30s --timeout=5s CMD true || exit 1
ENTRYPOINT ["MtlManager"]