#!/bin/bash

set -ex

docker image inspect automatic_dictionary:${THUNDERBIRD_VERSION} ||
  docker build --build-arg THUNDERBIRD_VERSION=$THUNDERBIRD_VERSION -t automatic_dictionary:${THUNDERBIRD_VERSION} .

if [ "$DEVEL_MODE" = "1" ]; then
   DEVEL_MODE_MODIFIERS="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e DEBUG=1 -e LOCAL_DEBUG=1 -v $PWD:/app "
fi

docker run -ti $DEVEL_MODE_MODIFIERS automatic_dictionary:${THUNDERBIRD_VERSION} /bin/bash -l -c "./integration_test.sh"

#!/bin/bash

set -ex

docker build --build-arg THUNDERBIRD_VERSION=$THUNDERBIRD_VERSION -t automatic_dictionary:${THUNDERBIRD_VERSION} .

if [ "$DEVEL_MODE" = "1" ]; then
   DEVEL_MODE_MODIFIERS="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e DEBUG=1 -e LOCAL_DEBUG=1 -v $PWD:/app "
fi

docker run -ti $DEVEL_MODE_MODIFIERS automatic_dictionary:${THUNDERBIRD_VERSION} /bin/bash -l -c "./integration_test.sh"

--- 
+++ 
@@ -2,7 +2,8 @@
 
 set -ex
 
-docker build --build-arg THUNDERBIRD_VERSION=$THUNDERBIRD_VERSION -t automatic_dictionary:${THUNDERBIRD_VERSION} .
+docker image inspect automatic_dictionary:${THUNDERBIRD_VERSION} ||
+  docker build --build-arg THUNDERBIRD_VERSION=$THUNDERBIRD_VERSION -t automatic_dictionary:${THUNDERBIRD_VERSION} .
 
 if [ "$DEVEL_MODE" = "1" ]; then
    DEVEL_MODE_MODIFIERS="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -e DEBUG=1 -e LOCAL_DEBUG=1 -v $PWD:/app "
Change integration tests to only build it when necessary

When developing and testing there is no need to rebuild the Docker image
every time we run the tests.
Docker has problems caching some layers so this way we workaround it.
