Skip to content

Commit

Permalink
docker: add dockerfile examples
Browse files Browse the repository at this point in the history
Let's add dockefile example. This greatly simplify avocado test development because
allow to create hermetic devel images w/o breaking system instalation

Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
Dmitry Monakhov authored and clebergnu committed Oct 7, 2016
1 parent 9fca107 commit df5d409
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
71 changes: 71 additions & 0 deletions contrib/docker/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This Dockerfile creates an debian image with avocado framework installed
# from source
#
# VERSION 0.1
################
## Usage example:
# git clone github.com/avocado-framework/avocado.git avocado.git
# cd avocado.git
## Make some changes
# patch -p1 < MY_PATCH
## Finally build a docker image
# docker build --force-rm -t debian-avocado-custom -f contrib/docker/Dockerfile.debian .
## Run test inside the docker image
# avocado run --docker fedora-avocado-custom passtest.py
#
FROM debian
MAINTAINER Dmitry Monakhov [email protected]
# Install and clean in one step to decrease image size

RUN apt-get update && \
echo install avocado def packages && \
apt-get install -y --no-install-recommends \
git \
rsync \
make \
gdebi-core \
pkg-config \
libvirt-dev \
python-dev \
python-lzma \
python-pip \
python-pystache \
python-setuptools \
python-stevedore \
python-yaml && \
echo install extra avocado packages && \
apt-get install -y --no-install-recommends \
ansible \
emacs-nox \
pigz \
libzip2 \
pxz && \
ln -f /usr/bin/pigz /bin/gzip && \
ln -f /usr/bin/pigz /usr/bin/gzip && \
echo install kernel-devel packages && \
apt-get install -y --no-install-recommends \
build-essential \
guilt \
bc \
flex \
bison \
libc6-dev \
libelf-dev \
libnuma-dev \
liblzma-dev && \
echo "Cleanup" && \
apt-get clean && \
rm -rf \
/usr/share/doc /usr/share/doc-base \
/usr/share/man /usr/share/locale /usr/share/zoneinfo

COPY . /devel/avocado-framework/avocado

RUN cd /devel/avocado-framework/avocado && \
make requirements && \
make install && \
mkdir -p /usr/share/avocado/data/cache && \
git config --global user.email "avocado@localhost" && \
git config --global user.name "Avocado tool" && \
rm -rf /devel/avocado-framework/avocado

38 changes: 38 additions & 0 deletions contrib/docker/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This Dockerfile creates an fedora image with avocado framework installed
# from source
#
# VERSION 0.1
################
## Usage example:
## Checkout avocado source
# git clone github.com/avocado-framework/avocado.git avocado.git
# cd avocado.git
## Make some changes
# patch -p1 < MY_PATCH
## Finally build a docker image
# docker build --force-rm -t fedora-avocado-custom -f contrib/docker/Dockerfile.fedora .
## Run test inside the docker image
# avocado run --docker fedora-avocado-custom passtest.py
#
FROM fedora

MAINTAINER Dmitry Monakhov [email protected]

COPY . /devel/avocado-framework/avocado

# Install and clean in one step to decrease image size
RUN dnf install -y \
gcc \
make \
python-devel \
python-pip \
libvirt-devel \
libyaml-devel \
redhat-rpm-config \
xz-devel \
which && \
cd /devel/avocado-framework/avocado && \
make requirements && \
make install && \
dnf clean all

26 changes: 26 additions & 0 deletions docs/source/RunningTestsRemotely.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,32 @@ image (``ldoktor/fedora-avocado``) in the default image repository
...
Status: Downloaded newer image for docker.io/ldoktor/fedora-avocado:latest

Use custom docker images
------------------------

One of the possible ways to use (and develop) Avocado is to create a
docker image with your development tree. This is a good way to test
your development branch without breaking your system.

To do so, you can following a few simple steps. Begin by fetching the
source code as usual::

$ git clone github.com/avocado-framework/avocado.git avocado.git

You may want to make some changes to Avocado::

$ cd avocado.git
$ patch -p1 < MY_PATCH

Finally build a docker image::

$ docker build -t fedora-avocado-custom -f contrib/docker/Dockerfile.fedora .

And now you can run tests with your modified Avocado inside your
container::

$ avocado run --docker fedora-avocado-custom examples/tests/passtest.py

Running your test
-----------------

Expand Down

0 comments on commit df5d409

Please sign in to comment.