From patchwork Tue Dec 3 11:42:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdul Halim X-Patchwork-Id: 63543 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BA88A04B5; Tue, 3 Dec 2019 12:43:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 679331F5; Tue, 3 Dec 2019 12:43:06 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 20F4A91 for ; Tue, 3 Dec 2019 12:43:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 03:43:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,273,1571727600"; d="scan'208";a="200971147" Received: from silpixa00399119.ir.intel.com (HELO silpixa00399119.ger.corp.intel.com) ([10.237.222.73]) by orsmga007.jf.intel.com with ESMTP; 03 Dec 2019 03:43:01 -0800 From: Abdul Halim To: dev@dpdk.org Cc: ray.kinsella@intel.com, yasufum.o@gmail.com, Abdul Halim Date: Tue, 3 Dec 2019 11:42:21 +0000 Message-Id: <1575373341-29969-1-git-send-email-abdul.halim@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1566924290-451677-1-git-send-email-abdul.halim@intel.com> References: <1566924290-451677-1-git-send-email-abdul.halim@intel.com> Subject: [dpdk-dev] [PATCH v3] build: add dockerfile for building docker image X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding a Dockerfile with Ubuntu bionic base image to build dpdk as shared library. This docker image could be used as base image to build and run dpdk applications in containers. Signed-off-by: Abdul Halim Tested-by: Ruifeng Wang --- v2: * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic * added call to ldconfig to update cache of libraries to include newly installed DPDK libs --- v3: * added example use-case of dpdk dockerfile in extras/README.md --- extras/Dockerfile.bionic | 40 +++++++++++++++++++++++++++++++++++++ extras/README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 extras/Dockerfile.bionic create mode 100644 extras/README.md diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic new file mode 100644 index 0000000..f83b720 --- /dev/null +++ b/extras/Dockerfile.bionic @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation +FROM ubuntu:bionic + +# install requirements for getting and building DPDK +# including dependencies for DPDK features +RUN apt-get update && apt-get install -y \ + build-essential \ + pkg-config \ + python3 \ + python3-pip \ + ninja-build \ + libjansson-dev \ + libbsd-dev \ + libnuma-dev \ + libssl-dev \ + zlib1g-dev \ + libpcap-dev \ + libibverbs-dev \ + && pip3 install meson \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +ADD . /tmp/dpdk + +WORKDIR /tmp/dpdk + +RUN meson build \ + -Ddefault_library=shared \ + -Dmachine=default \ + -Dper_library_versions=false \ + && ninja -C build install \ + && ldconfig \ + && cd /; rm -rf /tmp/dpdk + +WORKDIR / + +# Installed DPDK Shared library location: +# lib dir : /usr/local/lib/ +# include : /usr/local/include/ +# pkgconfig file: /usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc diff --git a/extras/README.md b/extras/README.md new file mode 100644 index 0000000..f38d7f1 --- /dev/null +++ b/extras/README.md @@ -0,0 +1,52 @@ +# Build DPDK Docker image + +To build a docker image run the following command from dpdk root directory. + +``` +DOCKER_TAG="dpdk" +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic . +``` + +# Example of how to use this dpdk library image + +The following steps shows how to use the dpdk shared library container to build +and run a dpdk application without having to build dpdk library for each +application. + +## Create a dpdk sample app docker file with 'dpdk' as the base image + +Create a docker file to build the dpdk helloworld application. Since, we are +creating a docker file for dpdk helloworld app we need to add the dpdk source +files, thus create the following docker file in dpdk root directory. + +``` +cat << EOF > Dockerfile.dpdkSampleApp +FROM dpdk + +ADD . /opt/dpdk + +WORKDIR /opt/dpdk/examples/helloworld +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld +EOF +``` + +## Build sample app docker image + +``` +DOCKERAPP_TAG="dpdk-helloworld" +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp . +``` + +This sample app now can be run like any other applicaiton in a docker container. + +``` +$ docker run --rm -it -v /dev/hugepages:/dev/hugepages dpdk-helloworld +``` + +## Running the sample app +Once inside the container run helloword binary + +``` +$ root@11233ed2e69c # helloworld +``` +