add docker-compose to allow easy testing across linux and java versions (#7958)

motivation: setup for testing across different permutations of linux and java versions

changes:
* refactor docker file to allow dynamic versions of centos and java
* add docker compose driver files for centos 6, 7 and java 1.8, 1.9, 1.10, 1.11
* update instructions
This commit is contained in:
tomer doron 2018-05-28 01:31:48 -07:00 committed by Norman Maurer
parent 9a3311506e
commit 94946f6324
12 changed files with 166 additions and 42 deletions

View File

@ -1,34 +0,0 @@
FROM centos:6
MAINTAINER netty@googlegroups.com
ENTRYPOINT /bin/bash
ENV SOURCE_DIR $HOME/source
ENV MAVEN_VERSION 3.5.2
ENV JAVA_VERSION 1.8.0
RUN mkdir $SOURCE_DIR
WORKDIR $SOURCE_DIR
# install dependencies
RUN yum install -y \
apr-devel \
autoconf \
automake \
git \
glibc-devel \
java-$JAVA_VERSION-openjdk-devel \
libtool \
lksctp-tools \
lsb-core \
make \
openssl-devel \
tar \
wget
RUN wget -q http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && tar xfz apache-maven-$MAVEN_VERSION-bin.tar.gz && mv apache-maven-$MAVEN_VERSION /opt/
RUN echo 'PATH=/opt/apache-maven-$MAVEN_VERSION/bin:$PATH' >> ~/.bashrc
RUN echo 'export JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION/"' >> ~/.bashrc
RUN rm -rf $SOURCE_DIR

27
docker/Dockerfile.centos Normal file
View File

@ -0,0 +1,27 @@
ARG centos_version=6
FROM centos:$centos_version
# needed to do again after FROM due to docker limitation
ARG centos_version
# install dependencies
RUN yum install -y \
apr-devel \
autoconf \
automake \
git \
glibc-devel \
libtool \
lksctp-tools \
lsb-core \
make \
openssl-devel \
tar \
wget
ARG java_version=1.8
ENV JAVA_VERSION $java_version
# installing java with jabba
RUN curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | JABBA_COMMAND="install $JAVA_VERSION -o /jdk" bash
RUN echo 'export JAVA_HOME="/jdk"' >> ~/.bashrc
RUN echo 'PATH=/jdk/bin:$PATH' >> ~/.bashrc

View File

@ -1,15 +1,19 @@
** Create a docker image **
```
docker build -f Dockerfile-netty-centos6 . -t netty-centos6
```
** Using the image **
# Using the docker images
```
cd /path/to/netty/
```
## centos 6 with java 8
```
docker run -it -v ~/.m2:/root/.m2 -v ~/.ssh:/root/.ssh -v ~/.gnupg:/root/.gnupg -v `pwd`:/code -w /code netty-centos6 bash
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run test
```
## centos 7 with java 9
```
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-7.19.yaml run test
```
etc, etc

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.10
build:
args:
centos_version : "6"
java_version : "1.10-0"
test:
image: netty:centos-6-1.10

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.11
build:
args:
centos_version : "6"
java_version : "1.11.0-14"
test:
image: netty:centos-6-1.11

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.8
build:
args:
centos_version : "6"
java_version : "1.8"
test:
image: netty:centos-6-1.8

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.9
build:
args:
centos_version : "6"
java_version : "zulu@1.9.0"
test:
image: netty:centos-6-1.9

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.10
build:
args:
centos_version : "7"
java_version : "1.10-0"
test:
image: netty:centos-7-1.10

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.11
build:
args:
centos_version : "7"
java_version : "1.11.0-14"
test:
image: netty:centos-7-1.11

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.8
build:
args:
centos_version : "7"
java_version : "1.8"
test:
image: netty:centos-7-1.8

View File

@ -0,0 +1,13 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.9
build:
args:
centos_version : "7"
java_version : "zulu@1.9.0"
test:
image: netty:centos-7-1.9

View File

@ -0,0 +1,23 @@
version: "3"
services:
runtime-setup:
image: netty:default
build:
context: .
dockerfile: Dockerfile.centos
common: &common
image: netty:default
depends_on: [runtime-setup]
volumes:
- ~/.ssh:/root/.ssh
- ~/.m2:/root/.m2
- ~/.gnupg:/root/.gnupg
- ..:/code
working_dir: /code
test:
<<: *common
command: /bin/bash -cl "./mvnw clean package -Dio.netty.testsuite.badHost=netty.io -DskipOsgiTestsuite=true"