Created
December 24, 2016 06:49
-
-
Save osvalr/d275fa4003b1b18389bc1168f21f92b6 to your computer and use it in GitHub Desktop.
barking docker containers for odoo instances using travisfile2dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Using travisfile2dockerfile this code will take charge to build your docker image and run your docker container for an | |
# Odoo instance just indicating the port you want to be mapped to web service as the only argument once your get into | |
# one folder travisfile2dockerfile created for you | |
# e.g. | |
# | |
# 1. run travisfile2dockerfile | |
# ~/ $ travisfile2dockerfile [email protected]:<ORG>/<REPOSITORY>.git <BRANCH> | |
# | |
# 2. get into your travisfile2dockerfile just-generated-folder | |
# ~/ $ cd /home/<USER>/<PATH-T2D-DIR>/script/git_github.com_<ORG>_<REPOSITORY>.git/<BRANCH>/<FOLDER_NUMBER> | |
# | |
# 3. use bark | |
# ~/../ $ ./t2d-bark.sh 8080 | |
# | |
# 4. wait and use your container | |
# > Repository: <REPOSITORY> | |
# > Image: 1fa09d1bafae | |
# [root@9f9e5441795b]~/build/ORG/REPOSITORY$ | |
# (BRANCH)$ | |
function bark { | |
port=$1 | |
if [ -z $port ]; then | |
echo "Port not defined"; | |
return 1 | |
fi | |
if [ ! -f Dockerfile ]; then | |
echo "Dockerfile doesn't exists"; | |
return 1 | |
fi | |
repo=`cat Dockerfile | grep TRAVIS_REPO_SLUG= | tr "=/" " " | awk '{ print $4 }'` | |
echo "> Repository: $repo" | |
log=`./10-build.sh --no-cache` | |
if [ $? -eq 0 ]; then | |
image=`echo $log | tail -1 | awk '{print $3}'` | |
echo "> Image: $image" | |
docker run -it --name ${repo}_${port} --entrypoint=bash -e LANG=en_US.UTF-8 -p $port:8069 -m 8g -itP $image | |
else | |
echo "Errors when running 10-build.sh" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment