[libgda] Docker tools improvements
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Docker tools improvements
- Date: Sun, 13 Sep 2015 19:29:58 +0000 (UTC)
commit 6b3d195bdab4fd9b5181fddb95775c14f463ca59
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Sep 13 21:28:44 2015 +0200
Docker tools improvements
docker-tools/README | 5 +
docker-tools/docker-tools.sh | 177 ++++++++++++++++++++
docker-tools/ldap-test-server/Dockerfile | 6 +-
docker-tools/ldap-test-server/README | 6 +-
docker-tools/ldap-test-server/build.sh | 23 +--
.../{ => setup-data}/gen_names_ldif.pl | 0
.../{ => setup-data}/ldif-data/.gitignore | 0
.../{ => setup-data}/ldif-data/alien.jpg | Bin 13324 -> 13324 bytes
.../{ => setup-data}/ldif-data/devilish.jpg | Bin 16434 -> 16434 bytes
.../{ => setup-data}/ldif-data/fluffy.jpg | Bin 31452 -> 31452 bytes
.../{ => setup-data}/ldif-data/glasses.jpg | Bin 17703 -> 17703 bytes
.../{ => setup-data}/ldif-data/orga-clean.ldif | 0
.../{ => setup-data}/ldif-data/orga.ldif | 0
.../{ => setup-data}/ldif-data/set-rights.ldif | 0
.../{ => setup-data}/ldif-data/setup.ldif | 0
.../{ => setup-data}/ldif-data/smile.jpg | Bin 15753 -> 15753 bytes
.../{ => setup-data}/ldif-data/smiley.jpg | Bin 15263 -> 15263 bytes
.../{ => setup-data}/ldif-data/smiley2.jpg | Bin 17612 -> 17612 bytes
.../ldap-test-server/{ => setup-data}/names.csv | 0
.../{ => setup-scripts}/install.sh | 0
.../ldap-test-server/{ => setup-scripts}/run.sh | 0
docker-tools/ldap-test-server/start.sh | 22 +---
docker-tools/ldap-test-server/stop.sh | 2 +
docker-tools/mingw-32-cross-compil/.gitignore | 2 +-
docker-tools/mingw-32-cross-compil/Dockerfile | 14 +-
docker-tools/mingw-32-cross-compil/README | 5 +-
docker-tools/mingw-32-cross-compil/build.sh | 26 +---
.../mingw-32-cross-compil/setup-data/.gitignore | 1 +
.../{ => setup-scripts}/do_packages | 0
.../{ => setup-scripts}/install.sh | 0
.../{ => setup-scripts}/mingw-configure | 0
.../{ => setup-scripts}/run_configure.sh | 0
docker-tools/mingw-32-cross-compil/start.sh | 47 ++----
docker-tools/mingw-64-cross-compil/.gitignore | 2 +-
docker-tools/mingw-64-cross-compil/Dockerfile | 14 +-
docker-tools/mingw-64-cross-compil/build.sh | 26 +---
.../mingw-64-cross-compil/setup-data/.gitignore | 1 +
.../{ => setup-scripts}/do_packages | 0
.../{ => setup-scripts}/install.sh | 0
.../{ => setup-scripts}/mingw-configure | 0
.../{ => setup-scripts}/run_configure.sh | 0
docker-tools/mingw-64-cross-compil/start.sh | 47 ++----
docker-tools/mysql-test-server/Dockerfile | 4 +-
docker-tools/mysql-test-server/README | 9 +-
docker-tools/mysql-test-server/build.sh | 21 +--
.../{ => setup-scripts}/install.sh | 0
.../mysql-test-server/{ => setup-scripts}/run.sh | 0
docker-tools/mysql-test-server/start.sh | 21 +--
docker-tools/mysql-test-server/stop.sh | 2 +
docker-tools/postgresql-test-server/Dockerfile | 4 +-
docker-tools/postgresql-test-server/README | 6 +-
docker-tools/postgresql-test-server/build.sh | 21 +--
.../{ => setup-scripts}/install.sh | 0
.../{ => setup-scripts}/run.sh | 0
docker-tools/postgresql-test-server/start.sh | 21 +--
docker-tools/postgresql-test-server/stop.sh | 2 +
56 files changed, 282 insertions(+), 255 deletions(-)
---
diff --git a/docker-tools/README b/docker-tools/README
new file mode 100644
index 0000000..5cae9a5
--- /dev/null
+++ b/docker-tools/README
@@ -0,0 +1,5 @@
+This directory contains Docker (https://www.docker.com/) images to test databases and do some cross
compilation
+of Libgda for Win32 and Win64 targets.
+
+The main script 'docker-tools.sh' can be used directly, or indirectly by using the build.sh, start.sh
+and stop.sh scripts in the various sub directories to manage the corresponding containers.
\ No newline at end of file
diff --git a/docker-tools/docker-tools.sh b/docker-tools/docker-tools.sh
new file mode 100755
index 0000000..c1a5ead
--- /dev/null
+++ b/docker-tools/docker-tools.sh
@@ -0,0 +1,177 @@
+#!/bin/bash
+#
+# Main docker script
+#
+
+function HELP {
+ echo "Usage: $0 <command> [options]"
+ echo " commands:"
+ echo " build: creates a docker image for the provider specified as option"
+ echo " (MUST be called from the docker image's specific directory)"
+ echo " start: starts a docker container for the provider specified as option"
+ echo " stop: stops the docker container for the provider specified as option"
+ echo " started: tests if the docker container for the provider specified as option is started"
+ echo " returns: 0 is started, and 1 otherwise"
+ echo " ex: $0 start MySQL"
+ exit 1
+}
+
+function ensure_image_exists {
+ image_name=$1
+ echo "Using image: $image_name"
+ img=`${docker_cmd} images -q "$image_name"`
+ if test "x$img" == "x"
+ then
+ echo "Docker image not found, use the ./build.sh script first to create it"
+ exit 1
+ fi
+}
+
+function remove_image_if_exists {
+ image_name=$1
+ echo "Using image: $image_name"
+ img=`${docker_cmd} images -q "$image_name"`
+ if test "x$img" != "x"
+ then
+ echo "Docker image found, removing it..."
+ $docker_cmd rmi "$image_name" || {
+ echo "Failed to remove image."
+ exit 1
+ }
+ fi
+}
+
+function ensure_container_running {
+ cont_name=$1
+ ${docker_cmd} inspect "$cont_name" > /dev/null 2>&1 || {
+ echo "Docker container '$cont_name' is not running"
+ exit 1
+ }
+}
+
+function ensure_container_not_running {
+ cont_name=$1
+ ${docker_cmd} inspect "$cont_name" > /dev/null 2>&1 && {
+ echo "Docker container '$cont_name' is running, you need to stop it first"
+ exit 1
+ }
+}
+
+docker_cmd=`which docker` || {
+ echo "Can't find docker, make sure it is installed, refer to https://www.docker.com/"
+ exit 1
+}
+
+"$docker_cmd" version > /dev/null 2>&1 || {
+ docker_cmd="sudo $docker_cmd"
+ $docker_cmd version > /dev/null 2>&1 || {
+ echo "Can't execute docker"
+ exit 1
+ }
+}
+echo "Using Docker command: $docker_cmd"
+
+function parse_provider_arg {
+ provider_name=$1
+ if test "x$provider_name" == "x"
+ then
+ HELP
+ fi
+ prov=${provider_name,,}
+ case $prov in
+ mingw*)
+ image_name="libgda-$prov"
+ container_name="cx-$prov"
+ ;;
+ *)
+ image_name="libgda-test-$prov"
+ container_name="test-$prov"
+ ;;
+ esac
+}
+
+function get_port_for_provider {
+ provider_name=${1,,}
+ case $provider_name in
+ mysql)
+ echo 3306
+ ;;
+ postgresql)
+ echo 5432
+ ;;
+ ldap)
+ echo 389
+ ;;
+ web)
+ echo 80
+ ;;
+ mingw*)
+ echo mingw
+ ;;
+ *)
+ echo "Unknown database server, could no determine port number"
+ exit 1
+ ;;
+ esac
+}
+
+case $1 in
+ build)
+ parse_provider_arg $2
+ ensure_container_not_running "$container_name"
+ remove_image_if_exists "$image_name"
+ echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on
you setup)..."
+ $docker_cmd build --force-rm -q -t "$image_name" . || {
+ echo "Failed to build image."
+ exit 1
+ }
+ echo "Image '$image_name' is now ready, you can use the start.sh script"
+ ;;
+ start)
+ parse_provider_arg $2
+ ensure_image_exists "$image_name"
+ ensure_container_not_running "$container_name"
+ port=`get_port_for_provider $2`
+ if test "x$port" == "xmingw"
+ then
+ # MinGW session
+ echo "Running $provider_name, use CTRL-D to stop it"
+ $docker_cmd run -ti -v ${gda_src}:/src/libgda:ro -v ${destdir}:/install -e UID=`id -u` -e GID=`id
-g` --rm "$image_name" || {
+ echo "Failed"
+ exit 1
+ }
+ else
+ # background
+ echo "Running $provider_name server in the background, on port $port use 'stop.sh' to stop it"
+ $docker_cmd run -d -p $port:$port --name "$container_name" "$image_name" > /dev/null 2>&1 || {
+ echo "Failed"
+ exit 1
+ }
+ fi
+ ;;
+ stop)
+ parse_provider_arg $2
+ ensure_container_running "$container_name"
+ echo "Stopping $provider_name server..."
+ $docker_cmd kill "$container_name" > /dev/null 2>& 1 || {
+ echo "Failed to kill container"
+ exit 1
+ }
+ $docker_cmd rm "$container_name" > /dev/null 2>& 1 || {
+ echo "Failed to remove container"
+ exit 1
+ }
+ ;;
+ started)
+ parse_provider_arg $2
+ ${docker_cmd} inspect "$container_name" > /dev/null 2>&1 || {
+ echo "stopped"
+ exit 1
+ }
+ echo "started"
+ exit 0
+ ;;
+ *)
+ HELP
+ ;;
+esac
diff --git a/docker-tools/ldap-test-server/Dockerfile b/docker-tools/ldap-test-server/Dockerfile
index 53dac8f..2f37394 100644
--- a/docker-tools/ldap-test-server/Dockerfile
+++ b/docker-tools/ldap-test-server/Dockerfile
@@ -1,10 +1,10 @@
FROM fedora:21
MAINTAINER Vivien Malerba "vmalerba gmail com"
-ENV REFRESHED_AT 2014-12-13
+ENV REFRESHED_AT 2015-09-12
-COPY install.sh run.sh /
-COPY ldif-data /ldif-data/
+COPY setup-scripts/install.sh setup-scripts/run.sh /
+COPY setup-data/ldif-data /ldif-data/
RUN /install.sh
EXPOSE 389
diff --git a/docker-tools/ldap-test-server/README b/docker-tools/ldap-test-server/README
index b4445f8..866e7af 100644
--- a/docker-tools/ldap-test-server/README
+++ b/docker-tools/ldap-test-server/README
@@ -1,10 +1,10 @@
Use the scripts contained here to create an OpenLDAP server docker image which can be used
to test Libgda's LDAP provider.
-* build.sh builds the docker image (named "libgda-test-ldap"). It uses the names.csv file to create the
+* ./build.sh builds the docker image (named "libgda-test-ldap"). It uses the names.csv file to create the
initial contents of the LDAP directory (fake Gnome-DB directory), using the gen_names_ldif.pl script.
-
-* start.sh starts a docker container from the built image, stop it using CTRL-C
+* ./start.sh starts a docker container in background
+* ./stop.sh stops a running docker container
diff --git a/docker-tools/ldap-test-server/build.sh b/docker-tools/ldap-test-server/build.sh
index 0d02b02..47c7e00 100755
--- a/docker-tools/ldap-test-server/build.sh
+++ b/docker-tools/ldap-test-server/build.sh
@@ -1,26 +1,11 @@
-#!/bin/sh
-
-#docker_cmd="sudo docker"
-docker_cmd="docker"
-image_name="libgda-test-ldap"
-
-# test docker install
-$docker_cmd version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
+#!/bin/bash
# build image
echo "Generating LDAP directory contents"
-./gen_names_ldif.pl || {
+pushd setup-data > /dev/null 2>&1 && ./gen_names_ldif.pl && popd > /dev/null 2>&1 || {
echo "Error"
exit 1
}
-echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on you
setup)..."
-$docker_cmd build --force-rm -q -t "$image_name" . || {
- echo "Failed to build image."
- exit 1
-}
-echo "Image '$image_name' is now ready, you can use the start.sh script"
-
+# actual build
+exec ../docker-tools.sh build LDAP
diff --git a/docker-tools/ldap-test-server/gen_names_ldif.pl
b/docker-tools/ldap-test-server/setup-data/gen_names_ldif.pl
similarity index 100%
rename from docker-tools/ldap-test-server/gen_names_ldif.pl
rename to docker-tools/ldap-test-server/setup-data/gen_names_ldif.pl
diff --git a/docker-tools/ldap-test-server/ldif-data/.gitignore
b/docker-tools/ldap-test-server/setup-data/ldif-data/.gitignore
similarity index 100%
rename from docker-tools/ldap-test-server/ldif-data/.gitignore
rename to docker-tools/ldap-test-server/setup-data/ldif-data/.gitignore
diff --git a/docker-tools/ldap-test-server/ldif-data/orga-clean.ldif
b/docker-tools/ldap-test-server/setup-data/ldif-data/orga-clean.ldif
similarity index 100%
rename from docker-tools/ldap-test-server/ldif-data/orga-clean.ldif
rename to docker-tools/ldap-test-server/setup-data/ldif-data/orga-clean.ldif
diff --git a/docker-tools/ldap-test-server/ldif-data/orga.ldif
b/docker-tools/ldap-test-server/setup-data/ldif-data/orga.ldif
similarity index 100%
rename from docker-tools/ldap-test-server/ldif-data/orga.ldif
rename to docker-tools/ldap-test-server/setup-data/ldif-data/orga.ldif
diff --git a/docker-tools/ldap-test-server/ldif-data/set-rights.ldif
b/docker-tools/ldap-test-server/setup-data/ldif-data/set-rights.ldif
similarity index 100%
rename from docker-tools/ldap-test-server/ldif-data/set-rights.ldif
rename to docker-tools/ldap-test-server/setup-data/ldif-data/set-rights.ldif
diff --git a/docker-tools/ldap-test-server/ldif-data/setup.ldif
b/docker-tools/ldap-test-server/setup-data/ldif-data/setup.ldif
similarity index 100%
rename from docker-tools/ldap-test-server/ldif-data/setup.ldif
rename to docker-tools/ldap-test-server/setup-data/ldif-data/setup.ldif
diff --git a/docker-tools/ldap-test-server/names.csv b/docker-tools/ldap-test-server/setup-data/names.csv
similarity index 100%
rename from docker-tools/ldap-test-server/names.csv
rename to docker-tools/ldap-test-server/setup-data/names.csv
diff --git a/docker-tools/ldap-test-server/install.sh b/docker-tools/ldap-test-server/setup-scripts/install.sh
similarity index 100%
rename from docker-tools/ldap-test-server/install.sh
rename to docker-tools/ldap-test-server/setup-scripts/install.sh
diff --git a/docker-tools/ldap-test-server/run.sh b/docker-tools/ldap-test-server/setup-scripts/run.sh
similarity index 100%
rename from docker-tools/ldap-test-server/run.sh
rename to docker-tools/ldap-test-server/setup-scripts/run.sh
diff --git a/docker-tools/ldap-test-server/start.sh b/docker-tools/ldap-test-server/start.sh
index 698a6c2..adc83ee 100755
--- a/docker-tools/ldap-test-server/start.sh
+++ b/docker-tools/ldap-test-server/start.sh
@@ -1,20 +1,2 @@
-#!/bin/sh
-
-image_name="libgda-test-ldap"
-
-# test docker install
-docker version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
-
-# test docker image
-img=`docker images -q "$image_name"`
-if test "x$img" == "x"
-then
- echo "The docker image '$image_name' is not present, use the ./build.sh script first"
- exit 1
-fi
-
-echo "Running LDAP server, hit CTRL-C to stop"
-docker run -t -i -p 389:389 --rm --name test-ldap "$image_name"
+#!/bin/bash
+exec ../docker-tools.sh start LDAP
diff --git a/docker-tools/ldap-test-server/stop.sh b/docker-tools/ldap-test-server/stop.sh
new file mode 100755
index 0000000..54c2f9c
--- /dev/null
+++ b/docker-tools/ldap-test-server/stop.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec ../docker-tools.sh stop LDAP
diff --git a/docker-tools/mingw-32-cross-compil/.gitignore b/docker-tools/mingw-32-cross-compil/.gitignore
index be4ae84..b851ce9 100644
--- a/docker-tools/mingw-32-cross-compil/.gitignore
+++ b/docker-tools/mingw-32-cross-compil/.gitignore
@@ -1 +1 @@
-Win32
+compilation-results
diff --git a/docker-tools/mingw-32-cross-compil/Dockerfile b/docker-tools/mingw-32-cross-compil/Dockerfile
index 4d3f311..1c46419 100644
--- a/docker-tools/mingw-32-cross-compil/Dockerfile
+++ b/docker-tools/mingw-32-cross-compil/Dockerfile
@@ -1,9 +1,9 @@
-FROM fedora:21
+FROM fedora:22
MAINTAINER Vivien Malerba "vmalerba gmail com"
-ENV REFRESHED_AT 2014-12-13
+ENV REFRESHED_AT 2015-09-12
-COPY install.sh /
+COPY setup-scripts/install.sh /
RUN /install.sh
RUN rm -f /install.sh
@@ -12,7 +12,7 @@ ENV SRC /src
# files installed outside of YUM
ENV DEPEND /dependencies
-COPY Win32 /dependencies/
+COPY setup-data/Win32 /dependencies/
# destination of the compiled files
RUN mkdir /install
@@ -22,8 +22,8 @@ ENV PREFIX /install
RUN mkdir -p /compilation/libgda
WORKDIR /compilation/libgda
-COPY run_configure.sh /compilation/libgda/configure
-COPY mingw-configure /compilation/libgda/.mingw-configure
-COPY do_packages /compilation/libgda/
+COPY setup-scripts/run_configure.sh /compilation/libgda/configure
+COPY setup-scripts/mingw-configure /compilation/libgda/.mingw-configure
+COPY setup-scripts/do_packages /compilation/libgda/
CMD [ "/bin/bash" ]
diff --git a/docker-tools/mingw-32-cross-compil/README b/docker-tools/mingw-32-cross-compil/README
index 1279778..18f73b0 100644
--- a/docker-tools/mingw-32-cross-compil/README
+++ b/docker-tools/mingw-32-cross-compil/README
@@ -2,10 +2,9 @@ Use the scripts contained here to create a MinGW docker image from which you can
cross compile Libgda. The source files are "mounted" into the container in /srv/libgda and the compiled files
are installed (when running "make install") in the path provided as the 1st argument to the start.sh script.
-* build.sh builds the docker image (named "libgda-mingw32"), and first checks and if necessary download the
+* ./build.sh builds the docker image (named "libgda-mingw32"), and first checks and if necessary download the
missing binary files (Win32/). Run without any argument.
-
-* start.sh starts a docker container from the built image, the 1st argument being the installation directory
(where
+* ./start.sh starts a docker container from the built image, the 1st argument being the installation
directory (where
the files are copied when running "make install"). It opens a shell where you
can run (as root inside the container):
# ./configure
diff --git a/docker-tools/mingw-32-cross-compil/build.sh b/docker-tools/mingw-32-cross-compil/build.sh
index 4a3d1aa..033fe85 100755
--- a/docker-tools/mingw-32-cross-compil/build.sh
+++ b/docker-tools/mingw-32-cross-compil/build.sh
@@ -1,20 +1,11 @@
-#!/bin/sh
-
-#docker_cmd="sudo docker"
-docker_cmd="docker"
-image_name="libgda-mingw32"
-
-# test docker install
-$docker_cmd version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
+#!/bin/bash
# download Win32 binaries if necessary
-if [ ! -d Win32 ]
+if [ ! -d setup-data/Win32 ]
then
echo "Missing Win32/ directory, downloading archive (about 3Mb)..."
tarball="https://people.gnome.org/~vivien/Win32_docker_02.txz"
+ pushd setup-data > /dev/null 2>&1
wget -q $tarball > /dev/null 2>&1 || {
echo "Unable to get $tarball, check with Libgda's maintainer!"
exit 1
@@ -26,13 +17,8 @@ then
exit 1
}
rm -f $file
+ popd > /dev/null 2>&1
fi
-# build image
-echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on you
setup)..."
-$docker_cmd build --force-rm -q -t "$image_name" . || {
- echo "Failed to build image."
- exit 1
-}
-echo "Image '$image_name' is now ready, you can use the start.sh script"
-
+# actual build
+exec ../docker-tools.sh build MinGW32
diff --git a/docker-tools/mingw-32-cross-compil/setup-data/.gitignore
b/docker-tools/mingw-32-cross-compil/setup-data/.gitignore
new file mode 100644
index 0000000..be4ae84
--- /dev/null
+++ b/docker-tools/mingw-32-cross-compil/setup-data/.gitignore
@@ -0,0 +1 @@
+Win32
diff --git a/docker-tools/mingw-32-cross-compil/do_packages
b/docker-tools/mingw-32-cross-compil/setup-scripts/do_packages
similarity index 100%
rename from docker-tools/mingw-32-cross-compil/do_packages
rename to docker-tools/mingw-32-cross-compil/setup-scripts/do_packages
diff --git a/docker-tools/mingw-32-cross-compil/install.sh
b/docker-tools/mingw-32-cross-compil/setup-scripts/install.sh
similarity index 100%
rename from docker-tools/mingw-32-cross-compil/install.sh
rename to docker-tools/mingw-32-cross-compil/setup-scripts/install.sh
diff --git a/docker-tools/mingw-32-cross-compil/mingw-configure
b/docker-tools/mingw-32-cross-compil/setup-scripts/mingw-configure
similarity index 100%
rename from docker-tools/mingw-32-cross-compil/mingw-configure
rename to docker-tools/mingw-32-cross-compil/setup-scripts/mingw-configure
diff --git a/docker-tools/mingw-32-cross-compil/run_configure.sh
b/docker-tools/mingw-32-cross-compil/setup-scripts/run_configure.sh
similarity index 100%
rename from docker-tools/mingw-32-cross-compil/run_configure.sh
rename to docker-tools/mingw-32-cross-compil/setup-scripts/run_configure.sh
diff --git a/docker-tools/mingw-32-cross-compil/start.sh b/docker-tools/mingw-32-cross-compil/start.sh
index 8a3dcdf..bc9dcdf 100755
--- a/docker-tools/mingw-32-cross-compil/start.sh
+++ b/docker-tools/mingw-32-cross-compil/start.sh
@@ -1,28 +1,7 @@
-#!/bin/sh
-
-image_name="libgda-mingw32"
-
-# test docker install
-docker version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
-
-# test docker image
-img=`docker images -q "$image_name"`
-if test "x$img" == "x"
-then
- echo "The docker image '$image_name' is not present, use the ./build.sh script first"
- exit 1
-fi
+#!/bin/bash
# determine destination DIR
-if test "$#" -eq 1
-then
- destdir=$1
-else
- destdir=/home/vivien/Devel/VMShared/bin-win32
-fi
+destdir="`pwd`/compilation-results"
if [ ! -e $destdir ]
then
echo "Destination directory '$destdir' does not exist"
@@ -33,13 +12,17 @@ pushd $destdir > /dev/null 2>& 1 || {
exit 1
}
destdir=`pwd`
+rm -rf libgda 2>& 1 || {
+ echo "Can't clean any previous build!"
+ exit 1
+}
popd > /dev/null 2>& 1 || {
echo "Can't get back to working directory!"
exit 1
}
echo "Destination files will be in $destdir/libgda"
-# get Libgda's sources dir
+# determine Libgda's sources dir
pushd ../.. > /dev/null 2>& 1 || {
echo "Can't go to directory ../.."
exit 1
@@ -49,17 +32,15 @@ popd > /dev/null 2>& 1 || {
echo "Can't get back to working directory!"
exit 1
}
-
-# get user and group ID
-if test "x$SUDO_UID" == "x"
+if [ -e $gda_src/Makefile ]
then
- uid=`id -u`
- gid=`id -g`
-else
- uid=$SUDO_UID
- gid=$SUDO_GID
+ echo "Source directory already configured; run \"make distclean\" there first"
+ exit 1
fi
+export gda_src
+export destdir
+
echo "Using libgda's source files in: ${gda_src}"
echo "Win32 compiled files will be in: ${destdir}"
echo "Once in the container, run:"
@@ -68,4 +49,4 @@ echo "# make"
echo "# make install"
echo "# ./do_packages"
echo ""
-docker run -t -i -v ${gda_src}:/src/libgda:ro -v ${destdir}:/install -e UID=$uid -e GID=$gid --rm
"$image_name"
+exec ../docker-tools.sh start MinGW32
diff --git a/docker-tools/mingw-64-cross-compil/.gitignore b/docker-tools/mingw-64-cross-compil/.gitignore
index 023331c..b851ce9 100644
--- a/docker-tools/mingw-64-cross-compil/.gitignore
+++ b/docker-tools/mingw-64-cross-compil/.gitignore
@@ -1 +1 @@
-Win64
+compilation-results
diff --git a/docker-tools/mingw-64-cross-compil/Dockerfile b/docker-tools/mingw-64-cross-compil/Dockerfile
index 79f8e2e..c2e966b 100644
--- a/docker-tools/mingw-64-cross-compil/Dockerfile
+++ b/docker-tools/mingw-64-cross-compil/Dockerfile
@@ -1,9 +1,9 @@
-FROM fedora:21
+FROM fedora:22
MAINTAINER Vivien Malerba "vmalerba gmail com"
-ENV REFRESHED_AT 2014-12-13
+ENV REFRESHED_AT 2015-09-12
-COPY install.sh /
+COPY setup-scripts/install.sh /
RUN /install.sh
RUN rm -f /install.sh
@@ -12,7 +12,7 @@ ENV SRC /src
# files installed outside of YUM
ENV DEPEND /dependencies
-COPY Win64 /dependencies/
+COPY setup-data/Win64 /dependencies/
# destination of the compiled files
RUN mkdir /install
@@ -22,8 +22,8 @@ ENV PREFIX /install
RUN mkdir -p /compilation/libgda
WORKDIR /compilation/libgda
-COPY run_configure.sh /compilation/libgda/configure
-COPY mingw-configure /compilation/libgda/.mingw-configure
-COPY do_packages /compilation/libgda/
+COPY setup-scripts/run_configure.sh /compilation/libgda/configure
+COPY setup-scripts/mingw-configure /compilation/libgda/.mingw-configure
+COPY setup-scripts/do_packages /compilation/libgda/
CMD [ "/bin/bash" ]
diff --git a/docker-tools/mingw-64-cross-compil/build.sh b/docker-tools/mingw-64-cross-compil/build.sh
index ed89668..46668e3 100755
--- a/docker-tools/mingw-64-cross-compil/build.sh
+++ b/docker-tools/mingw-64-cross-compil/build.sh
@@ -1,20 +1,11 @@
-#!/bin/sh
-
-#docker_cmd="sudo docker"
-docker_cmd="docker"
-image_name="libgda-mingw64"
-
-# test docker install
-$docker_cmd version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
+#!/bin/bash
# download Win64 binaries if necessary
-if [ ! -d Win64 ]
+if [ ! -d setup-data/Win64 ]
then
echo "Missing Win64/ directory, downloading archive (about 1Mb)..."
tarball="https://people.gnome.org/~vivien/Win64_docker_02.txz"
+ pushd setup-data > /dev/null 2>&1
wget -q $tarball > /dev/null 2>&1 || {
echo "Unable to get $tarball, check with Libgda's maintainer!"
exit 1
@@ -26,13 +17,8 @@ then
exit 1
}
rm -f $file
+ popd > /dev/null 2>&1
fi
-# build image
-echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on you
setup)..."
-$docker_cmd build --force-rm -q -t "$image_name" . || {
- echo "Failed to build image."
- exit 1
-}
-echo "Image '$image_name' is now ready, you can use the start.sh script"
-
+# actual build
+exec ../docker-tools.sh build MinGW64
diff --git a/docker-tools/mingw-64-cross-compil/setup-data/.gitignore
b/docker-tools/mingw-64-cross-compil/setup-data/.gitignore
new file mode 100644
index 0000000..023331c
--- /dev/null
+++ b/docker-tools/mingw-64-cross-compil/setup-data/.gitignore
@@ -0,0 +1 @@
+Win64
diff --git a/docker-tools/mingw-64-cross-compil/do_packages
b/docker-tools/mingw-64-cross-compil/setup-scripts/do_packages
similarity index 100%
rename from docker-tools/mingw-64-cross-compil/do_packages
rename to docker-tools/mingw-64-cross-compil/setup-scripts/do_packages
diff --git a/docker-tools/mingw-64-cross-compil/install.sh
b/docker-tools/mingw-64-cross-compil/setup-scripts/install.sh
similarity index 100%
rename from docker-tools/mingw-64-cross-compil/install.sh
rename to docker-tools/mingw-64-cross-compil/setup-scripts/install.sh
diff --git a/docker-tools/mingw-64-cross-compil/mingw-configure
b/docker-tools/mingw-64-cross-compil/setup-scripts/mingw-configure
similarity index 100%
rename from docker-tools/mingw-64-cross-compil/mingw-configure
rename to docker-tools/mingw-64-cross-compil/setup-scripts/mingw-configure
diff --git a/docker-tools/mingw-64-cross-compil/run_configure.sh
b/docker-tools/mingw-64-cross-compil/setup-scripts/run_configure.sh
similarity index 100%
rename from docker-tools/mingw-64-cross-compil/run_configure.sh
rename to docker-tools/mingw-64-cross-compil/setup-scripts/run_configure.sh
diff --git a/docker-tools/mingw-64-cross-compil/start.sh b/docker-tools/mingw-64-cross-compil/start.sh
index 5db8e83..7504eca 100755
--- a/docker-tools/mingw-64-cross-compil/start.sh
+++ b/docker-tools/mingw-64-cross-compil/start.sh
@@ -1,28 +1,7 @@
-#!/bin/sh
-
-image_name="libgda-mingw64"
-
-# test docker install
-docker version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
-
-# test docker image
-img=`docker images -q "$image_name"`
-if test "x$img" == "x"
-then
- echo "The docker image '$image_name' is not present, use the ./build.sh script first"
- exit 1
-fi
+#!/bin/bash
# determine destination DIR
-if test "$#" -eq 1
-then
- destdir=$1
-else
- destdir=/home/vivien/Devel/VMShared/bin-win64
-fi
+destdir="`pwd`/compilation-results"
if [ ! -e $destdir ]
then
echo "Destination directory '$destdir' does not exist"
@@ -33,13 +12,17 @@ pushd $destdir > /dev/null 2>& 1 || {
exit 1
}
destdir=`pwd`
+rm -rf libgda 2>& 1 || {
+ echo "Can't clean any previous build!"
+ exit 1
+}
popd > /dev/null 2>& 1 || {
echo "Can't get back to working directory!"
exit 1
}
echo "Destination files will be in $destdir/libgda"
-# get Libgda's sources dir
+# determine Libgda's sources dir
pushd ../.. > /dev/null 2>& 1 || {
echo "Can't go to directory ../.."
exit 1
@@ -49,17 +32,15 @@ popd > /dev/null 2>& 1 || {
echo "Can't get back to working directory!"
exit 1
}
-
-# get user and group ID
-if test "x$SUDO_UID" == "x"
+if [ -e $gda_src/Makefile ]
then
- uid=`id -u`
- gid=`id -g`
-else
- uid=$SUDO_UID
- gid=$SUDO_GID
+ echo "Source directory already configured; run \"make distclean\" there first"
+ exit 1
fi
+export gda_src
+export destdir
+
echo "Using libgda's source files in: ${gda_src}"
echo "Win64 compiled files will be in: ${destdir}"
echo "Once in the container, run:"
@@ -68,4 +49,4 @@ echo "# make"
echo "# make install"
echo "# ./do_packages"
echo ""
-docker run -t -i -v ${gda_src}:/src/libgda:ro -v ${destdir}:/install -e UID=$uid -e GID=$gid --rm
"$image_name"
+exec ../docker-tools.sh start MinGW64
diff --git a/docker-tools/mysql-test-server/Dockerfile b/docker-tools/mysql-test-server/Dockerfile
index 3dae33a..de774c2 100644
--- a/docker-tools/mysql-test-server/Dockerfile
+++ b/docker-tools/mysql-test-server/Dockerfile
@@ -1,9 +1,9 @@
FROM fedora:21
MAINTAINER Vivien Malerba "vmalerba gmail com"
-ENV REFRESHED_AT 2015-01-04
+ENV REFRESHED_AT 2015-09-02
-COPY install.sh run.sh /
+COPY setup-scripts/install.sh setup-scripts/run.sh /
COPY setup-data /setup-data
RUN /install.sh
diff --git a/docker-tools/mysql-test-server/README b/docker-tools/mysql-test-server/README
index 0750663..117ca71 100644
--- a/docker-tools/mysql-test-server/README
+++ b/docker-tools/mysql-test-server/README
@@ -1,10 +1,10 @@
Use the scripts contained here to create a MySQL server docker image which can be used
to test Libgda's MySQL provider.
-* build.sh builds the docker image (named "libgda-test-mysql"). It creates a database populated with
+* ./build.sh builds the docker image (named "libgda-test-mysql"). It creates a database populated with
data from the NorthWind database (https://code.google.com/p/northwindextended/).
-
-* start.sh starts a docker container from the built image, stop it using CTRL-C
+* ./start.sh starts a docker container in background
+* ./stop.sh stops a running docker container
Parameters:
@@ -18,4 +18,5 @@ MySQL test:
----------------
$ mysql -h 127.0.0.1 -u gdauser --password=gdauser gda
-$ gda-sql-6.0 "MySQL://gdauser:gdauser HOST=127 0 0 1;DB_NAME=gda"
\ No newline at end of file
+$ gda-sql-6.0 "MySQL://gdauser:gdauser HOST=127 0 0 1;DB_NAME=gda"
+
diff --git a/docker-tools/mysql-test-server/build.sh b/docker-tools/mysql-test-server/build.sh
index 1563f3b..c89b1c9 100755
--- a/docker-tools/mysql-test-server/build.sh
+++ b/docker-tools/mysql-test-server/build.sh
@@ -1,14 +1,4 @@
-#!/bin/sh
-
-#docker_cmd="sudo docker"
-docker_cmd="docker"
-image_name="libgda-test-mysql"
-
-# test docker install
-$docker_cmd version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
+#!/bin/bash
# download Northwind data if necessary
sqlfile=setup-data/northwind.sql
@@ -24,10 +14,5 @@ then
echo "Download complete"
fi
-echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on you
setup)..."
-$docker_cmd build --force-rm -q -t "$image_name" . || {
- echo "Failed to build image."
- exit 1
-}
-echo "Image '$image_name' is now ready, you can use the start.sh script"
-
+# actual build
+exec ../docker-tools.sh build MySQL
diff --git a/docker-tools/mysql-test-server/install.sh
b/docker-tools/mysql-test-server/setup-scripts/install.sh
similarity index 100%
rename from docker-tools/mysql-test-server/install.sh
rename to docker-tools/mysql-test-server/setup-scripts/install.sh
diff --git a/docker-tools/mysql-test-server/run.sh b/docker-tools/mysql-test-server/setup-scripts/run.sh
similarity index 100%
rename from docker-tools/mysql-test-server/run.sh
rename to docker-tools/mysql-test-server/setup-scripts/run.sh
diff --git a/docker-tools/mysql-test-server/start.sh b/docker-tools/mysql-test-server/start.sh
index b92cfda..e922fab 100755
--- a/docker-tools/mysql-test-server/start.sh
+++ b/docker-tools/mysql-test-server/start.sh
@@ -1,20 +1,3 @@
-#!/bin/sh
+#!/bin/bash
+exec ../docker-tools.sh start MySQL
-image_name="libgda-test-mysql"
-
-# test docker install
-docker version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
-
-# test docker image
-img=`docker images -q "$image_name"`
-if test "x$img" == "x"
-then
- echo "The docker image '$image_name' is not present, use the ./build.sh script first"
- exit 1
-fi
-
-echo "Running MySQL server, hit CTRL-C to stop"
-docker run -t -i -p 3306:3306 --rm --name test-mysql "$image_name"
diff --git a/docker-tools/mysql-test-server/stop.sh b/docker-tools/mysql-test-server/stop.sh
new file mode 100755
index 0000000..dcbe873
--- /dev/null
+++ b/docker-tools/mysql-test-server/stop.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec ../docker-tools.sh stop MySQL
diff --git a/docker-tools/postgresql-test-server/Dockerfile b/docker-tools/postgresql-test-server/Dockerfile
index 8841d34..dfcdac5 100644
--- a/docker-tools/postgresql-test-server/Dockerfile
+++ b/docker-tools/postgresql-test-server/Dockerfile
@@ -1,9 +1,9 @@
FROM fedora:21
MAINTAINER Vivien Malerba "vmalerba gmail com"
-ENV REFRESHED_AT 2014-12-13
+ENV REFRESHED_AT 2015-09-12
-COPY install.sh run.sh /
+COPY setup-scripts/install.sh setup-scripts/run.sh /
COPY setup-data /setup-data
RUN /install.sh
diff --git a/docker-tools/postgresql-test-server/README b/docker-tools/postgresql-test-server/README
index 05a7035..9935aa8 100644
--- a/docker-tools/postgresql-test-server/README
+++ b/docker-tools/postgresql-test-server/README
@@ -1,10 +1,10 @@
Use the scripts contained here to create a PostgreSQL server docker image which can be used
to test Libgda's PostgreSQL provider.
-* build.sh builds the docker image (named "libgda-test-postgresql"). It creates a database populated with
+* ./build.sh builds the docker image (named "libgda-test-postgresql"). It creates a database populated with
data from the NorthWind database (https://code.google.com/p/northwindextended/).
-
-* start.sh starts a docker container from the built image, stop it using CTRL-C
+* ./start.sh starts a docker container in background
+* ./stop.sh stops a running docker container
Parameters:
diff --git a/docker-tools/postgresql-test-server/build.sh b/docker-tools/postgresql-test-server/build.sh
index 4b94bb2..414c37d 100755
--- a/docker-tools/postgresql-test-server/build.sh
+++ b/docker-tools/postgresql-test-server/build.sh
@@ -1,14 +1,4 @@
-#!/bin/sh
-
-#docker_cmd="sudo docker"
-docker_cmd="docker"
-image_name="libgda-test-postgresql"
-
-# test docker install
-$docker_cmd version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
+#!/bin/bash
# download Northwind data if necessary
sqlfile=setup-data/northwind.sql
@@ -24,10 +14,5 @@ then
echo "Download complete"
fi
-echo "Now building Docker image, this will take a few minutes (or maybe half an hour, depending on you
setup)..."
-$docker_cmd build --force-rm -q -t "$image_name" . || {
- echo "Failed to build image."
- exit 1
-}
-echo "Image '$image_name' is now ready, you can use the start.sh script"
-
+# actual build
+exec ../docker-tools.sh build PostgreSQL
diff --git a/docker-tools/postgresql-test-server/install.sh
b/docker-tools/postgresql-test-server/setup-scripts/install.sh
similarity index 100%
rename from docker-tools/postgresql-test-server/install.sh
rename to docker-tools/postgresql-test-server/setup-scripts/install.sh
diff --git a/docker-tools/postgresql-test-server/run.sh
b/docker-tools/postgresql-test-server/setup-scripts/run.sh
similarity index 100%
rename from docker-tools/postgresql-test-server/run.sh
rename to docker-tools/postgresql-test-server/setup-scripts/run.sh
diff --git a/docker-tools/postgresql-test-server/start.sh b/docker-tools/postgresql-test-server/start.sh
index 5a18644..29b29fa 100755
--- a/docker-tools/postgresql-test-server/start.sh
+++ b/docker-tools/postgresql-test-server/start.sh
@@ -1,20 +1,3 @@
-#!/bin/sh
+#!/bin/bash
+exec ../docker-tools.sh start PostgreSQL
-image_name="libgda-test-postgresql"
-
-# test docker install
-docker version > /dev/null 2>&1 || {
- echo "Can't find or execute docker"
- exit 1
-}
-
-# test docker image
-img=`docker images -q "$image_name"`
-if test "x$img" == "x"
-then
- echo "The docker image '$image_name' is not present, use the ./build.sh script first"
- exit 1
-fi
-
-echo "Running PostgreSQL server, hit CTRL-C to stop"
-docker run -t -i -p 5432:5432 --rm --name test-postgres "$image_name"
diff --git a/docker-tools/postgresql-test-server/stop.sh b/docker-tools/postgresql-test-server/stop.sh
new file mode 100755
index 0000000..6aba567
--- /dev/null
+++ b/docker-tools/postgresql-test-server/stop.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec ../docker-tools.sh stop postgreSQL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]