From 84ddabd00a61acaecd396f89430f98e030eb8d04 Mon Sep 17 00:00:00 2001
From: Sergii Kipot <skipot@sipwise.com>
Date: Mon, 22 Jan 2018 14:48:47 +0100
Subject: [PATCH] TT#29456 Add netscript-jessie Dockerfile

The docker will be used for netscript-unit-test-docker test

Change-Id: I3c41f7aa80fe3d098c89b42d3b6b199ebad7b6b7
---
 t/Dockerfile | 33 +++++++++++++++++++++++++++++++++
 t/testrunner | 21 +++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 t/Dockerfile
 create mode 100755 t/testrunner

diff --git a/t/Dockerfile b/t/Dockerfile
new file mode 100644
index 0000000..5b4359e
--- /dev/null
+++ b/t/Dockerfile
@@ -0,0 +1,33 @@
+# DOCKER_NAME=netscript-jessie
+FROM docker.mgm.sipwise.com/sipwise-jessie:latest
+
+# Important! Update this no-op ENV variable when this Dockerfile
+# is updated with the current date. It will force refresh of all
+# of the base images and things like `apt-get update` won't be using
+# old cached versions when the Dockerfile is built.
+ENV REFRESHED_AT 2018-01-22
+
+RUN apt-get update && apt-get install --assume-yes git make
+
+RUN echo './t/testrunner' >>/root/.bash_history
+
+WORKDIR /code/
+
+################################################################################
+# Instructions for usage
+# ----------------------
+# When you want to build the base image from scratch
+# jump to the next section if you don't want to build yourself!:
+#
+# % docker build --tag="lua-ngcp-kamailio-jessie" -f t/Dockerfile .
+# % docker run --rm -i -t -v $(pwd):/code:rw lua-ngcp-kamailio-jessie:latest bash
+#
+# Use the existing docker image:
+# % docker pull docker.mgm.sipwise.com/lua-ngcp-kamailio-jessie
+# NOTE: run the following command from root folder of git repository:
+# % docker run --rm -i -t -v $(pwd):/code:rw docker.mgm.sipwise.com/lua-ngcp-kamailio-jessie:latest bash
+#
+# Inside docker (the command is in history, just press UP button):
+#   ./t/testrunner
+#
+################################################################################
diff --git a/t/testrunner b/t/testrunner
new file mode 100755
index 0000000..981e1c7
--- /dev/null
+++ b/t/testrunner
@@ -0,0 +1,21 @@
+#!/bin/bash
+# This script is used for running the tests with proper arguments
+# from within Jenkins
+
+set -e
+set -u
+
+if [ -d /results ] ; then
+  # Running from Jenkins (RW)
+  RESULTS="/results"
+
+  cd "/code"
+else
+  # Running locally in Docker
+  RESULTS="./results"
+  mkdir -p "${RESULTS}"
+fi
+
+make
+make syntaxcheck
+make script_version