2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-09 23:00:56 +00:00

convert edge build to travis.sh

This commit is contained in:
chabad360 2020-03-03 05:03:13 +00:00
parent 97ec097870
commit 84d53bfcba
2 changed files with 86 additions and 25 deletions

View File

@ -13,6 +13,7 @@ before_install:
- if [[ $BUILD == "development" ]];then - if [[ $BUILD == "development" ]];then
sudo apt-get update && sudo apt-get -y install docker-compose; sudo apt-get update && sudo apt-get -y install docker-compose;
fi fi
- chmod u+x ./travis.sh
after_success: after_success:
- docker --version - docker --version
@ -22,43 +23,28 @@ matrix:
- name: "Build Frappe python environment (edge)" - name: "Build Frappe python environment (edge)"
if: branch = develop AND type != pull_request if: branch = develop AND type != pull_request
script: script:
- docker build -t frappe-worker -f build/frappe-worker/Dockerfile . - ./travis.sh --worker --tag edge --name frappe
- docker tag frappe-worker frappe/frappe-worker:edge - ./travis.sh --worker --tag develop --name frappe --tag-only
- docker tag frappe-worker frappe/frappe-worker:develop
- docker push frappe/frappe-worker:edge
- docker push frappe/frappe-worker:develop
- name: "Build Frappe nginx + static assets (edge)" - name: "Build Frappe nginx + static assets (edge)"
if: branch = develop AND type != pull_request if: branch = develop AND type != pull_request
script: script:
- docker build -t frappe-assets -f build/frappe-assets/Dockerfile . - ./travis.sh --assets --tag edge --name frappe
- docker tag frappe-assets frappe/frappe-assets:edge - ./travis.sh --assets --tag develop --name frappe --tag-only
- docker tag frappe-assets frappe/frappe-assets:develop
- docker push frappe/frappe-assets:edge
- docker push frappe/frappe-assets:develop
- name: "Build ERPNext python environment (edge)" - name: "Build ERPNext python environment (edge)"
if: branch = develop AND type != pull_request if: branch = develop AND type != pull_request
script: script:
- docker build -t erpnext-worker -f build/erpnext-worker/Dockerfile . - ./travis.sh --worker --tag edge --name erpnext
- docker tag erpnext-worker frappe/erpnext-worker:edge - ./travis.sh --worker --tag develop --name erpnext --tag-only
- docker tag erpnext-worker frappe/erpnext-worker:develop
- docker push frappe/erpnext-worker:edge
- docker push frappe/erpnext-worker:develop
- name: "Build ERPNext nginx + static assets (edge)" - name: "Build ERPNext nginx + static assets (edge)"
if: branch = develop AND type != pull_request if: branch = develop AND type != pull_request
script: script:
- docker build -t erpnext-assets -f build/erpnext-assets/Dockerfile . - ./travis.sh --assets --tag edge --name erpnext
- docker tag erpnext-assets frappe/erpnext-assets:edge - ./travis.sh --assets --tag develop --name erpnext --tag-only
- docker tag erpnext-assets frappe/erpnext-assets:develop
- docker push frappe/erpnext-assets:edge
- docker push frappe/erpnext-assets:develop
- name: "Build Frappe socketio service (edge)" - name: "Build Frappe socketio service (edge)"
if: branch = develop AND type != pull_request if: branch = develop AND type != pull_request
script: script:
- docker build -t frappe-socketio -f build/frappe-socketio/Dockerfile . - ./travis.sh --socketio --tag edge --name frappe
- docker tag frappe-socketio frappe/frappe-socketio:edge - ./travis.sh --socketio --tag develop --name frappe --tag-only
- docker tag frappe-socketio frappe/frappe-socketio:develop
- docker push frappe/frappe-socketio:edge
- docker push frappe/frappe-socketio:develop
- name: "Build Frappe python environment (v12)" - name: "Build Frappe python environment (v12)"
if: branch = master AND type != pull_request if: branch = master AND type != pull_request
script: script:

75
travis.sh Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
################# travis.sh #################
# This script takes care of the common steps
# found in the Travis CI builds.
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-t|--tag)
TAG="$2"
shift
shift
;;
-w|--worker)
WORKER=1
shift
;;
-a|--assets)
ASSETS=1
shift
;;
-s|--socketio)
SOCKETIO=1
shift
;;
-n|--name)
NAME="$2"
shift
shift
;;
-o|--tag-only)
TAGONLY=1
shift
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
function tagAndPush() {
echo "Tagging ${1} as \"${2}\" and pushing"
docker tag ${1} frappe/${1}:${2}
docker push frappe/${1}:${2}
}
function build () {
echo "Building ${1} ${3} image"
docker build -t ${1}-${3} -f build/${1}-worker/Dockerfile .
tagAndPush "${1}-${3}" ${2}
}
if [[ $WORKER ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-worker" ${TAG}
else
build $NAME $TAG worker
fi
elif [[ $ASSETS ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-assets" ${TAG}
else
build $NAME $TAG assets
fi
elif [[ $SOCKETIO ]]; then
if [[ $TAGONLY ]]; then
tagAndPush "${NAME}-socketio" ${TAG}
else
build $NAME $TAG socketio
fi
fi