Skip to content

Commit 0bf6275

Browse files
committed
additional image layer for python2&3
1 parent d74bb02 commit 0bf6275

File tree

9 files changed

+102
-27
lines changed

9 files changed

+102
-27
lines changed

Makefile

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ SCANNER_DATE := `date +%Y-%m-%d`
3131
SCANNER_DATE_YEST := `TZ=GMT+24 +%Y:%m:%d`
3232
SCANNER_VERSION := v8
3333
SCANNER_LOCALIP := $(shell ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | awk '{print $1}' | head -n 1)
34-
SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8
35-
CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8
34+
SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
35+
CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
3636
ifeq ($(shell uname), Linux)
3737
SCANNER_FILE = clair-scanner_linux_amd64
3838
else ifeq ($(shell uname), Darwin)
@@ -44,7 +44,7 @@ endif
4444

4545
.PHONY: tests interactive_tutorials
4646

47-
all: splunk uf
47+
all: splunk uf splunk-py23 uf-py23
4848

4949
ansible:
5050
@if [ -d "splunk-ansible" ]; then \
@@ -225,6 +225,61 @@ uf-windows-2016: base-windows-2016 ansible
225225
--build-arg SPLUNK_BUILD_URL=${UF_WIN_BUILD_URL} \
226226
-t uf-windows-2016:${IMAGE_VERSION} .
227227

228+
229+
##### Python 3 support #####
230+
splunk-py23: splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8
231+
232+
splunk-py23-debian-9: splunk-debian-9
233+
docker build ${DOCKER_BUILD_FLAGS} \
234+
-f py23-image/debian-9/Dockerfile \
235+
--build-arg SPLUNK_PRODUCT=splunk \
236+
-t splunk-py23-debian-9:${IMAGE_VERSION} .
237+
238+
splunk-py23-debian-10: splunk-debian-10
239+
docker build ${DOCKER_BUILD_FLAGS} \
240+
-f py23-image/debian-10/Dockerfile \
241+
--build-arg SPLUNK_PRODUCT=splunk \
242+
-t splunk-py23-debian-10:${IMAGE_VERSION} .
243+
244+
splunk-py23-centos-7: splunk-centos-7
245+
docker build ${DOCKER_BUILD_FLAGS} \
246+
-f py23-image/centos-7/Dockerfile \
247+
--build-arg SPLUNK_PRODUCT=splunk \
248+
-t splunk-py23-centos-7:${IMAGE_VERSION} .
249+
250+
splunk-py23-redhat-8: splunk-redhat-8
251+
docker build ${DOCKER_BUILD_FLAGS} \
252+
-f py23-image/redhat-8/Dockerfile \
253+
--build-arg SPLUNK_PRODUCT=splunk \
254+
-t splunk-py23-redhat-8:${IMAGE_VERSION} .
255+
256+
uf-py23: uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
257+
258+
uf-py23-debian-9: uf-debian-9
259+
docker build ${DOCKER_BUILD_FLAGS} \
260+
-f py23-image/debian-9/Dockerfile \
261+
--build-arg SPLUNK_PRODUCT=uf \
262+
-t uf-py23-debian-9:${IMAGE_VERSION} .
263+
264+
uf-py23-debian-10: uf-debian-10
265+
docker build ${DOCKER_BUILD_FLAGS} \
266+
-f py23-image/debian-10/Dockerfile \
267+
--build-arg SPLUNK_PRODUCT=uf \
268+
-t uf-py23-debian-10:${IMAGE_VERSION} .
269+
270+
uf-py23-centos-7: uf-centos-7
271+
docker build ${DOCKER_BUILD_FLAGS} \
272+
-f py23-image/centos-7/Dockerfile \
273+
--build-arg SPLUNK_PRODUCT=uf \
274+
-t uf-py23-centos-7:${IMAGE_VERSION} .
275+
276+
uf-py23-redhat-8: uf-redhat-8
277+
docker build ${DOCKER_BUILD_FLAGS} \
278+
-f py23-image/redhat-8/Dockerfile \
279+
--build-arg SPLUNK_PRODUCT=uf \
280+
-t uf-py23-redhat-8:${IMAGE_VERSION} .
281+
282+
228283
##### Tests #####
229284
sample-compose-up: sample-compose-down
230285
docker-compose -f test_scenarios/${SPLUNK_COMPOSE} up -d
@@ -279,28 +334,28 @@ test_splunk_python3_all: test_splunk_centos7_python3 test_splunk_redhat8_python3
279334
test_uf_python3_all: test_uf_centos7_python3 test_uf_redhat8_python3 test_uf_debian9_python3 test_uf_debian10_python3
280335

281336
test_splunk_centos7_python3:
282-
$(call test_python3_installation, splunk-centos-7)
337+
$(call test_python3_installation, splunk-py23-centos-7)
283338

284339
test_splunk_redhat8_python3:
285-
$(call test_python3_installation, splunk-redhat-8)
340+
$(call test_python3_installation, splunk-py23-redhat-8)
286341

287342
test_splunk_debian9_python3:
288-
$(call test_python3_installation, splunk-debian-9)
343+
$(call test_python3_installation, splunk-py23-debian-9)
289344

290345
test_splunk_debian10_python3:
291-
$(call test_python3_installation, splunk-debian-10)
346+
$(call test_python3_installation, splunk-py23-debian-10)
292347

293348
test_uf_centos7_python3:
294-
$(call test_python3_installation, uf-centos-7)
349+
$(call test_python3_installation, uf-py23-centos-7)
295350

296351
test_uf_redhat8_python3:
297-
$(call test_python3_installation, uf-redhat-8)
352+
$(call test_python3_installation, uf-py23-redhat-8)
298353

299354
test_uf_debian9_python3:
300-
$(call test_python3_installation, uf-debian-9)
355+
$(call test_python3_installation, uf-py23-debian-9)
301356

302357
test_uf_debian10_python3:
303-
$(call test_python3_installation, uf-debian-10)
358+
$(call test_python3_installation, uf-py23-debian-10)
304359

305360
define test_python3_installation
306361
docker run -d --rm --name $1 -it $1 bash
@@ -315,28 +370,28 @@ test_splunk_python2_all: test_splunk_centos7_python2 test_splunk_redhat8_python2
315370
test_uf_python2_all: test_uf_centos7_python2 test_uf_redhat8_python2 test_uf_debian9_python2 test_uf_debian10_python2
316371

317372
test_splunk_centos7_python2:
318-
$(call test_python2_installation, splunk-centos-7)
373+
$(call test_python2_installation, splunk-py23-centos-7)
319374

320375
test_splunk_redhat8_python2:
321-
$(call test_python2_installation, splunk-redhat-8)
376+
$(call test_python2_installation, splunk-py23-redhat-8)
322377

323378
test_splunk_debian9_python2:
324-
$(call test_python2_installation, splunk-debian-9)
379+
$(call test_python2_installation, splunk-py23-debian-9)
325380

326381
test_splunk_debian10_python2:
327-
$(call test_python2_installation, splunk-debian-10)
382+
$(call test_python2_installation, splunk-py23-debian-10)
328383

329384
test_uf_centos7_python2:
330-
$(call test_python2_installation, uf-centos-7)
385+
$(call test_python2_installation, uf-py23-centos-7)
331386

332387
test_uf_redhat8_python2:
333-
$(call test_python2_installation, uf-redhat-8)
388+
$(call test_python2_installation, uf-py23-redhat-8)
334389

335390
test_uf_debian9_python2:
336-
$(call test_python2_installation, uf-debian-9)
391+
$(call test_python2_installation, uf-py23-debian-9)
337392

338393
test_uf_debian10_python2:
339-
$(call test_python2_installation, uf-debian-10)
394+
$(call test_python2_installation, uf-py23-debian-10)
340395

341396
#python2 version print to stderr, hence the 2>&1
342397
define test_python2_installation

base/centos-7/install.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export LANG=en_US.utf8
2020

2121
yum -y update && yum -y install wget sudo epel-release
2222
yum -y install busybox ansible python-requests
23-
yum -y install python36 python36-requests
24-
python3 -m ensurepip
2523

2624
cd /bin
2725
ln -s busybox killall

base/debian-10/install.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ apt update
3333
# put back tools for customer support
3434
apt-get install -y --no-install-recommends curl sudo libgssapi-krb5-2 busybox procps acl
3535
apt-get install -y --no-install-recommends python-pip python-setuptools python-requests python-yaml
36-
apt-get install -y --no-install-recommends python3 python3-pip python3-setuptools python3-requests python3-yaml
3736
pip --no-cache-dir install ansible
38-
pip3 --no-cache-dir install ansible
3937

4038
cd /bin
4139
ln -s busybox killall

base/debian-9/install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ apt-get update
3636
apt-cache show ansible
3737
apt-get install -y --no-install-recommends ansible curl sudo libgssapi-krb5-2 busybox procps acl
3838
apt-get install -y --no-install-recommends python-requests
39-
apt-get install -y --no-install-recommends python3 python3-pip python3-requests
4039

4140
cd /bin
4241
ln -s busybox diff

base/redhat-8/install.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ microdnf -y --nodocs install wget sudo shadow-utils procps
3030
wget https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64
3131
mv busybox-x86_64 /bin/busybox
3232
chmod +x /bin/busybox
33-
microdnf -y --nodocs install python2 tar python3
34-
alternatives --set python /usr/bin/python2
33+
microdnf -y --nodocs install python2 tar
3534
pip2 -q --no-cache-dir install requests ansible
36-
pip3 -q --no-cache-dir install requests ansible
3735

3836
cd /bin
3937
ln -s busybox diff

py23-image/centos-7/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG SPLUNK_PRODUCT=splunk
2+
FROM ${SPLUNK_PRODUCT}-centos-7:latest
3+
USER root
4+
5+
RUN yum -y update
6+
RUN yum -y install python36 python36-requests
7+
RUN python3 -m ensurepip

py23-image/debian-10/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG SPLUNK_PRODUCT=splunk
2+
FROM ${SPLUNK_PRODUCT}-debian-10:latest
3+
USER root
4+
5+
RUN apt update
6+
RUN apt-get install -y --no-install-recommends python3 python3-pip python3-setuptools python3-requests python3-yaml
7+
RUN pip3 --no-cache-dir install ansible

py23-image/debian-9/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG SPLUNK_PRODUCT=splunk
2+
FROM ${SPLUNK_PRODUCT}-debian-9:latest
3+
USER root
4+
5+
RUN apt-get update
6+
RUN apt-get install -y --no-install-recommends python3 python3-pip python3-requests

py23-image/redhat-8/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG SPLUNK_PRODUCT=splunk
2+
FROM ${SPLUNK_PRODUCT}-redhat-8:latest
3+
USER root
4+
5+
RUN microdnf -y --nodocs install python3
6+
RUN alternatives --set python /usr/bin/python2
7+
RUN pip3 -q --no-cache-dir install requests ansible

0 commit comments

Comments
 (0)