build: add dockerfile for building docker image

Message ID 1566924290-451677-1-git-send-email-abdul.halim@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series build: add dockerfile for building docker image |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Abdul Halim Aug. 27, 2019, 4:44 p.m. UTC
  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 <abdul.halim@intel.com>
---
 extras/Dockerfile.ubuntu | 38 ++++++++++++++++++++++++++++++++++++++
 extras/README.md         |  8 ++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 extras/Dockerfile.ubuntu
 create mode 100644 extras/README.md
  

Comments

Ray Kinsella Sept. 30, 2019, 8:54 a.m. UTC | #1
Hi Abdul,

Comments inline.

On 27/08/2019 17:44, Abdul Halim wrote:
> 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 <abdul.halim@intel.com>
> ---
>  extras/Dockerfile.ubuntu | 38 ++++++++++++++++++++++++++++++++++++++
>  extras/README.md         |  8 ++++++++
>  2 files changed, 46 insertions(+)
>  create mode 100644 extras/Dockerfile.ubuntu
>  create mode 100644 extras/README.md
> 
> diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu

So I would be concerned about it being called Dockerfile.ubuntu, because
at the moment it only covers Bionic, and Xenial is still supported until
April 21. The pattern FD.io VPP adopts is calling it Dockerfile.bionic.

> new file mode 100644
> index 0000000..3d5b36b
> --- /dev/null
> +++ b/extras/Dockerfile.ubuntu
> @@ -0,0 +1,38 @@
> +# 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 \
> +	pkgconf \
> +	python3 \
> +	python3-pip \
> +	ninja-build \
> +	libjansson-dev \
> +	libbsd-dev \
> +	libnuma-dev \
> +	libssl-dev \
> +	zlib1g-dev \
> +	libpcap-dev \
> +	libibverbs-dev \
> +		&& pip3 install meson
> +
> +ADD . /tmp/dpdk
> +
> +WORKDIR /tmp/dpdk
> +
> +RUN meson build \
> +	-Ddefault_library=shared \
> +	-Dmachine=default \
> +	-Dper_library_versions=false \
> +		&& ninja -C build install \
> +        && cd /; rm -rf /tmp/dpdk
> +

Is it safe to remove /tmp/dpdk, then remove the WORKDIR.
Should be the other way around?

> +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..967ddf7
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,8 @@
> +# 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.ubuntu .
> +```
>
  
Abdul Halim Sept. 30, 2019, 12:21 p.m. UTC | #2
Hi Ray,
Thanks for your feedback.
Please see comments inline.

> -----Original Message-----
> From: Ray Kinsella [mailto:mdr@ashroe.eu]
> Sent: Monday, September 30, 2019 9:54 AM
> To: Halim, Abdul <abdul.halim@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] build: add dockerfile for building docker
> image
> 
> Hi Abdul,
> 
> Comments inline.
> 
> On 27/08/2019 17:44, Abdul Halim wrote:
> > 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 <abdul.halim@intel.com>
> > ---
> >  extras/Dockerfile.ubuntu | 38
> ++++++++++++++++++++++++++++++++++++++
> >  extras/README.md         |  8 ++++++++
> >  2 files changed, 46 insertions(+)
> >  create mode 100644 extras/Dockerfile.ubuntu  create mode 100644
> > extras/README.md
> >
> > diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu
> 
> So I would be concerned about it being called Dockerfile.ubuntu, because at
> the moment it only covers Bionic, and Xenial is still supported until April 21.
> The pattern FD.io VPP adopts is calling it Dockerfile.bionic.

I will rename this file to Dockerfile.bionic as suggested.

> 
> > new file mode 100644
> > index 0000000..3d5b36b
> > --- /dev/null
> > +++ b/extras/Dockerfile.ubuntu
> > @@ -0,0 +1,38 @@
> > +# 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 \
> > +	pkgconf \
> > +	python3 \
> > +	python3-pip \
> > +	ninja-build \
> > +	libjansson-dev \
> > +	libbsd-dev \
> > +	libnuma-dev \
> > +	libssl-dev \
> > +	zlib1g-dev \
> > +	libpcap-dev \
> > +	libibverbs-dev \
> > +		&& pip3 install meson
> > +
> > +ADD . /tmp/dpdk
> > +
> > +WORKDIR /tmp/dpdk
> > +
> > +RUN meson build \
> > +	-Ddefault_library=shared \
> > +	-Dmachine=default \
> > +	-Dper_library_versions=false \
> > +		&& ninja -C build install \
> > +        && cd /; rm -rf /tmp/dpdk
> > +
> 
> Is it safe to remove /tmp/dpdk, then remove the WORKDIR.
> Should be the other way around?
>

The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it. It is very much like 'cd' into a location for other commands to run in there. Once the dpdk build is finished successfully and library is installed we no longer need the source files in the final image. So, we can safely remove it and the subsequent ' WORKDIR /' instruction below ensures that WORKDIR is set to a valid location.
 
> > +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..967ddf7
> > --- /dev/null
> > +++ b/extras/README.md
> > @@ -0,0 +1,8 @@
> > +# 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.ubuntu .
> > +```
> >
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
  

Patch

diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu
new file mode 100644
index 0000000..3d5b36b
--- /dev/null
+++ b/extras/Dockerfile.ubuntu
@@ -0,0 +1,38 @@ 
+# 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 \
+	pkgconf \
+	python3 \
+	python3-pip \
+	ninja-build \
+	libjansson-dev \
+	libbsd-dev \
+	libnuma-dev \
+	libssl-dev \
+	zlib1g-dev \
+	libpcap-dev \
+	libibverbs-dev \
+		&& pip3 install meson
+
+ADD . /tmp/dpdk
+
+WORKDIR /tmp/dpdk
+
+RUN meson build \
+	-Ddefault_library=shared \
+	-Dmachine=default \
+	-Dper_library_versions=false \
+		&& ninja -C build install \
+        && 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..967ddf7
--- /dev/null
+++ b/extras/README.md
@@ -0,0 +1,8 @@ 
+# 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.ubuntu .
+```