Skip to content

Commit

Permalink
misc: Add docker build argument for distribution tests
Browse files Browse the repository at this point in the history
This commit adds build arguments in Dockerfiles,
which enables tests for distributions.

With this commit, we can test uftrace in specific distros
like `docker build --build-arg test=yes .`.

Signed-off-by: Kang Minchul <[email protected]>
  • Loading branch information
kangtegong authored and namhyung committed Sep 14, 2021
1 parent 04c5a1c commit c3906f1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 13 deletions.
7 changes: 6 additions & 1 deletion misc/docker/alpine/3.13/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FROM alpine:3.13
ARG test
RUN apk update
RUN apk add build-base linux-headers git bash libunwind-dev
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make install
RUN if [ "${test}" == "yes" ] ; then \
cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make install; \
fi
7 changes: 6 additions & 1 deletion misc/docker/alpine/3.14/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FROM alpine:3.14
ARG test
RUN apk update
RUN apk add build-base linux-headers git bash libunwind-dev
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make install
RUN if [ "${test}" == "yes" ] ; then \
cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh && ./configure && make && make install; \
fi
9 changes: 7 additions & 2 deletions misc/docker/arch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FROM archlinux/base:latest
FROM archlinux:latest
ARG test
RUN pacman -Sy
RUN yes | pacman -S git gcc make
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
16 changes: 15 additions & 1 deletion misc/docker/centos/7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
FROM centos:7
ARG test
RUN yum install -y git gcc make epel-release
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

# update gcc version
RUN yum install -y centos-release-scl
RUN yum install -y devtoolset-9-gcc* devtoolset-9-libasan-devel devtoolset-9-libubsan-devel
RUN echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc
SHELL ["/bin/bash", "--login", "-c"]

RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace \
&& ./misc/install-deps.sh -y \
&& ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
9 changes: 8 additions & 1 deletion misc/docker/fedora/33/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM fedora:33
ARG test
RUN yum install -y git gcc make
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace \
&& ./misc/install-deps.sh -y \
&& ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
9 changes: 8 additions & 1 deletion misc/docker/fedora/34/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM fedora:34
ARG test
RUN yum install -y git gcc make
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace \
&& ./misc/install-deps.sh -y \
&& ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
13 changes: 10 additions & 3 deletions misc/docker/ubuntu/16.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM ubuntu:16.04
ARG test
RUN apt-get update \
&& apt-get install -y --no-install-recommends git gcc make ca-certificates
&& apt-get install -y --no-install-recommends git gcc make ca-certificates
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace \
&& ./misc/install-deps.sh -y \
&& ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*
13 changes: 10 additions & 3 deletions misc/docker/ubuntu/18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM ubuntu:18.04
ARG test
RUN apt-get update \
&& apt-get install -y --no-install-recommends git gcc make ca-certificates
&& apt-get install -y --no-install-recommends git gcc make ca-certificates
RUN mkdir -p /usr/src
RUN git clone https://github.com/namhyung/uftrace /usr/src/uftrace
RUN cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install
RUN if [ "$test" = "yes" ] ; then \
cd /usr/src/uftrace \
&& ./misc/install-deps.sh -y \
&& ./configure && make ASAN=1 && make ASAN=1 unittest; \
else \
cd /usr/src/uftrace && ./misc/install-deps.sh -y && ./configure && make && make install; \
fi
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

0 comments on commit c3906f1

Please sign in to comment.