Skip to content

Commit 32e8c59

Browse files
authored
Merge pull request #696 from bart0sh/PR111-switch-opae-nlb-demo-to-debian
Switch opae-nlb-demo to Debian
2 parents 331f472 + 7310de2 commit 32e8c59

File tree

1 file changed

+21
-40
lines changed

1 file changed

+21
-40
lines changed

demo/opae-nlb-demo/Dockerfile

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,38 @@
1-
# CLEAR_LINUX_BASE and CLEAR_LINUX_VERSION can be used to make the build
2-
# reproducible by choosing an image by its hash and installing an OS version
3-
# with --version=:
4-
# CLEAR_LINUX_BASE=clearlinux@sha256:b8e5d3b2576eb6d868f8d52e401f678c873264d349e469637f98ee2adf7b33d4
5-
# CLEAR_LINUX_VERSION="--version=29970"
6-
#
7-
# This is used on release branches before tagging a stable version.
8-
# The main branch defaults to using the latest Clear Linux.
9-
ARG CLEAR_LINUX_BASE=clearlinux:latest
1+
# Fedora is a recommended distro for OPAE
2+
# https://opae.github.io/latest
3+
ARG FEDORA_RELEASE="32"
4+
FROM fedora:${FEDORA_RELEASE} as builder
105

11-
FROM ${CLEAR_LINUX_BASE} as builder
6+
# Install build dependencies
7+
RUN dnf install -y git-core curl cmake gcc gcc-c++ make spdlog-devel kernel-headers libedit-devel libuuid-devel json-c-devel cli11-devel python-devel
128

13-
ARG CLEAR_LINUX_VERSION=
9+
# Download and unpack OPAE tarball
10+
ARG OPAE_RELEASE=2.0.2-1
11+
ARG OPAE_SHA256=2cc4d55d6b41eb0dee6927b0984329c0eee798b2e183dc434479757ae603b5e1
1412

15-
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION} && \
16-
swupd bundle-add wget c-basic devpkg-json-c devpkg-util-linux devpkg-hwloc devpkg-tbb git
17-
# Fetch dependencies and source code
18-
ARG OPAE_RELEASE=1.5.0-2
19-
20-
# workaround for a swupd failure discussed in https://github.com/clearlinux/distribution/issues/831
21-
RUN ldconfig
2213
RUN mkdir -p /usr/src/opae && \
2314
cd /usr/src/opae && \
24-
wget -q https://github.com/OPAE/opae-sdk/archive/${OPAE_RELEASE}.tar.gz -O- | tar -zx
15+
curl -fsSL https://github.com/OPAE/opae-sdk/archive/${OPAE_RELEASE}.tar.gz -o opae.tar.gz && \
16+
echo "$OPAE_SHA256 opae.tar.gz" | sha256sum -c - && \
17+
tar -xzf opae.tar.gz && \
18+
rm -f opae.tar.gz
2519

2620
# Build OPAE
2721
RUN cd /usr/src/opae/opae-sdk-${OPAE_RELEASE} && \
2822
mkdir build && \
2923
cd build && \
3024
CFLAGS="$CFLAGS -Wno-misleading-indentation" \
31-
cmake -DCMAKE_BUILD_TYPE=Release -DOPAE_BUILD_LIBOPAE_PY=OFF .. && \
32-
make xfpga nlb0 nlb3
33-
34-
# Install clean os-core and libstdcpp bundle in target directory
35-
RUN mkdir /install_root \
36-
&& swupd os-install \
37-
${CLEAR_LINUX_VERSION} \
38-
--path /install_root --statedir /swupd-state \
39-
--bundles=libstdcpp \
40-
--no-boot-update \
41-
&& rm -rf /install_root/var/lib/swupd/*
25+
cmake .. && \
26+
make -j xfpga nlb0 nlb3
4227

43-
# Minimal result image
44-
FROM scratch as final
45-
ENV PATH="/usr/local/bin/:${PATH}"
46-
COPY --from=builder /install_root /
47-
48-
# OPAE
49-
# nlb0 and nlb3 examples
28+
# Copy required nlb* utils and their dependencies to the final image
29+
FROM debian:unstable-slim
5030
COPY --from=builder /usr/src/opae/opae-sdk-*/build/bin/nlb* /usr/local/bin/
51-
# libxfpga.so, libopae-c*.so*
52-
COPY --from=builder /usr/src/opae/opae-sdk-*/build/lib/lib*.so* /usr/local/lib64/
31+
COPY --from=builder /usr/src/opae/opae-sdk-*/build/lib /usr/local/lib/
32+
RUN rm -rf /usr/local/lib/python3
33+
RUN ldconfig
5334

54-
RUN echo /usr/local/lib64/ >> /etc/ld.so.conf && ldconfig
35+
RUN apt-get update && apt-get install -y libjson-c4
5536

5637
COPY test_fpga.sh /usr/local/bin/
5738
ENTRYPOINT ["/usr/local/bin/test_fpga.sh"]

0 commit comments

Comments
 (0)