mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-08 22:31:07 +00:00
no longer conflict with #93
This commit is contained in:
commit
2d459987c3
208
.travis.yml
208
.travis.yml
@ -13,6 +13,7 @@ before_install:
|
||||
- if [[ $BUILD == "development" ]];then
|
||||
sudo apt-get update && sudo apt-get -y install docker-compose;
|
||||
fi
|
||||
- chmod u+x ./travis.py
|
||||
|
||||
after_success:
|
||||
- docker --version
|
||||
@ -22,180 +23,87 @@ jobs:
|
||||
- stage: "Build Frappe python environment (edge)"
|
||||
if: branch = develop AND type != pull_request
|
||||
script:
|
||||
- docker build -t frappe-worker -f build/frappe-worker/Dockerfile .
|
||||
- docker tag frappe-worker frappe/frappe-worker:edge
|
||||
- docker tag frappe-worker frappe/frappe-worker:develop
|
||||
- docker push frappe/frappe-worker:edge
|
||||
- docker push frappe/frappe-worker:develop
|
||||
- ./travis.py frappe --worker --tag edge
|
||||
- ./travis.py frappe --worker --tag develop --tag-only
|
||||
- stage: "Build Frappe nginx + static assets (edge)"
|
||||
if: branch = develop AND type != pull_request
|
||||
script:
|
||||
- docker build -t frappe-assets -f build/frappe-assets/Dockerfile .
|
||||
- docker tag frappe-assets frappe/frappe-assets:edge
|
||||
- docker tag frappe-assets frappe/frappe-assets:develop
|
||||
- docker push frappe/frappe-assets:edge
|
||||
- docker push frappe/frappe-assets:develop
|
||||
- ./travis.py frappe --nginx --tag edge
|
||||
- ./travis.py frappe --nginx --tag develop--tag-only
|
||||
- stage: "Build ERPNext python environment (edge)"
|
||||
if: branch = develop AND type != pull_request
|
||||
script:
|
||||
- docker build -t erpnext-worker -f build/erpnext-worker/Dockerfile .
|
||||
- docker tag erpnext-worker frappe/erpnext-worker:edge
|
||||
- docker tag erpnext-worker frappe/erpnext-worker:develop
|
||||
- docker push frappe/erpnext-worker:edge
|
||||
- docker push frappe/erpnext-worker:develop
|
||||
- ./travis.py erpnext --worker --tag edge
|
||||
- ./travis.py erpnext --worker --tag develop --tag-only
|
||||
- stage: "Build ERPNext nginx + static assets (edge)"
|
||||
if: branch = develop AND type != pull_request
|
||||
script:
|
||||
- docker build -t erpnext-assets -f build/erpnext-assets/Dockerfile .
|
||||
- docker tag erpnext-assets frappe/erpnext-assets:edge
|
||||
- docker tag erpnext-assets frappe/erpnext-assets:develop
|
||||
- docker push frappe/erpnext-assets:edge
|
||||
- docker push frappe/erpnext-assets:develop
|
||||
- ./travis.py erpnext --nginx --tag edge
|
||||
- ./travis.py erpnext --nginx --tag develop --tag-only
|
||||
- stage: "Build Frappe socketio service (edge)"
|
||||
if: branch = develop AND type != pull_request
|
||||
script:
|
||||
- docker build -t frappe-socketio -f build/frappe-socketio/Dockerfile .
|
||||
- docker tag frappe-socketio frappe/frappe-socketio:edge
|
||||
- docker tag frappe-socketio frappe/frappe-socketio:develop
|
||||
- docker push frappe/frappe-socketio:edge
|
||||
- docker push frappe/frappe-socketio:develop
|
||||
- ./travis.py frappe --socketio --tag edge
|
||||
- ./travis.py frappe --socketio --tag develop --tag-only
|
||||
- stage: "Build Frappe python environment (v12)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-12
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-worker:$VERSION -f build/frappe-worker/v12.Dockerfile .
|
||||
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:version-12
|
||||
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:v12
|
||||
- docker push frappe/frappe-worker:$VERSION
|
||||
- docker push frappe/frappe-worker:version-12
|
||||
- docker push frappe/frappe-worker:v12
|
||||
- ./travis.py frappe --worker --git-branch 12
|
||||
- ./travis.py frappe --worker --tag v12 --tag-only
|
||||
- ./travis.py frappe --worker --tag version-12 --tag-only
|
||||
- stage: "Build Frappe nginx + static assets (v12)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-12
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-assets:$VERSION -f build/frappe-assets/v12.Dockerfile .
|
||||
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:version-12
|
||||
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:v12
|
||||
- docker push frappe/frappe-assets:$VERSION
|
||||
- docker push frappe/frappe-assets:version-12
|
||||
- docker push frappe/frappe-assets:v12
|
||||
- ./travis.py frappe --nginx --git-branch 12
|
||||
- ./travis.py frappe --nginx --tag v12 --tag-only
|
||||
- ./travis.py frappe --nginx --tag version-12 --tag-only
|
||||
- stage: "Build ERPNext python environment (v12)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/erpnext --branch version-12
|
||||
- cd erpnext
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/erpnext-worker:$VERSION -f build/erpnext-worker/v12.Dockerfile .
|
||||
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:version-12
|
||||
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:v12
|
||||
- docker push frappe/erpnext-worker:$VERSION
|
||||
- docker push frappe/erpnext-worker:version-12
|
||||
- docker push frappe/erpnext-worker:v12
|
||||
- ./travis.py erpnext --worker --git-branch 12
|
||||
- ./travis.py erpnext --worker --tag v12 --tag-only
|
||||
- ./travis.py erpnext --worker --tag version-12 --tag-only
|
||||
- stage: "Build ERPNext nginx + static assets (v12)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/erpnext --branch version-12
|
||||
- cd erpnext
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/erpnext-assets:$VERSION -f build/erpnext-assets/v12.Dockerfile .
|
||||
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:version-12
|
||||
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:v12
|
||||
- docker push frappe/erpnext-assets:$VERSION
|
||||
- docker push frappe/erpnext-assets:version-12
|
||||
- docker push frappe/erpnext-assets:v12
|
||||
- stage: "Build Frappe socketio service (v12)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-12
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v12*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-socketio:$VERSION -f build/frappe-socketio/v12.Dockerfile .
|
||||
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:version-12
|
||||
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:v12
|
||||
- docker push frappe/frappe-socketio:$VERSION
|
||||
- docker push frappe/frappe-socketio:version-12
|
||||
- docker push frappe/frappe-socketio:v12
|
||||
- stage: "Build Frappe python environment (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-11
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-worker:$VERSION -f build/frappe-worker/v11.Dockerfile .
|
||||
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:version-11
|
||||
- docker tag frappe/frappe-worker:$VERSION frappe/frappe-worker:v11
|
||||
- docker push frappe/frappe-worker:$VERSION
|
||||
- docker push frappe/frappe-worker:version-11
|
||||
- docker push frappe/frappe-worker:v11
|
||||
- stage: "Build Frappe nginx + static assets (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-11
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-assets:$VERSION -f build/frappe-assets/v11.Dockerfile .
|
||||
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:version-11
|
||||
- docker tag frappe/frappe-assets:$VERSION frappe/frappe-assets:v11
|
||||
- docker push frappe/frappe-assets:$VERSION
|
||||
- docker push frappe/frappe-assets:version-11
|
||||
- docker push frappe/frappe-assets:v11
|
||||
- stage: "Build ERPNext python environment (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/erpnext --branch version-11
|
||||
- cd erpnext
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/erpnext-worker:$VERSION -f build/erpnext-worker/v11.Dockerfile .
|
||||
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:version-11
|
||||
- docker tag frappe/erpnext-worker:$VERSION frappe/erpnext-worker:v11
|
||||
- docker push frappe/erpnext-worker:$VERSION
|
||||
- docker push frappe/erpnext-worker:version-11
|
||||
- docker push frappe/erpnext-worker:v11
|
||||
- stage: "Build ERPNext nginx + static assets (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/erpnext --branch version-11
|
||||
- cd erpnext
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/erpnext-assets:$VERSION -f build/erpnext-assets/v11.Dockerfile .
|
||||
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:version-11
|
||||
- docker tag frappe/erpnext-assets:$VERSION frappe/erpnext-assets:v11
|
||||
- docker push frappe/erpnext-assets:$VERSION
|
||||
- docker push frappe/erpnext-assets:version-11
|
||||
- docker push frappe/erpnext-assets:v11
|
||||
- ./travis.py erpnext --nginx --git-branch 12
|
||||
- ./travis.py erpnext --nginx --tag v12 --tag-only
|
||||
- ./travis.py erpnext --nginx --tag version-12 --tag-only
|
||||
- stage: "Build Frappe socketio service (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- git clone https://github.com/frappe/frappe --branch version-11
|
||||
- cd frappe
|
||||
- git fetch --tags
|
||||
- export VERSION=$(git tag --list --sort=-version:refname "v11*" | sed -n 1p | sed -e 's#.*@\(\)#\1#')
|
||||
- cd ..
|
||||
- docker build -t frappe/frappe-socketio:$VERSION -f build/frappe-socketio/v11.Dockerfile .
|
||||
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:version-11
|
||||
- docker tag frappe/frappe-socketio:$VERSION frappe/frappe-socketio:v11
|
||||
- docker push frappe/frappe-socketio:$VERSION
|
||||
- docker push frappe/frappe-socketio:version-11
|
||||
- docker push frappe/frappe-socketio:v11
|
||||
- ./travis.py frappe --socketio --git-branch 11
|
||||
- ./travis.py frappe --socketio --tag v11 --tag-only
|
||||
- ./travis.py frappe --socketio --tag version-11 --tag-only
|
||||
- stage: "Build Frappe python environment (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- ./travis.py frappe --worker --git-branch 11
|
||||
- ./travis.py frappe --worker --tag v11 --tag-only
|
||||
- ./travis.py frappe --worker --tag version-11 --tag-only
|
||||
- stage: "Build Frappe nginx + static assets (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- ./travis.py erpnext frappe --nginx --git-branch 11
|
||||
- ./travis.py erpnext frappe --nginx --tag v11 --tag-only
|
||||
- ./travis.py erpnext frappe --nginx --tag version-11 --tag-only
|
||||
- stage: "Build ERPNext python environment (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- ./travis.py erpnext --worker --git-branch 11
|
||||
- ./travis.py erpnext --worker --tag v11 --tag-only
|
||||
- ./travis.py erpnext --worker --tag version-11 --tag-only
|
||||
- stage: "Build ERPNext nginx + static assets (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- ./travis.py erpnext --nginx --git-branch 11
|
||||
- ./travis.py erpnext --nginx --tag v11 --tag-only
|
||||
- ./travis.py erpnext --nginx --tag version-11 --tag-only
|
||||
- stage: "Build Frappe socketio service (v11)"
|
||||
if: branch = master AND type != pull_request
|
||||
script:
|
||||
- ./travis.py frappe --socketio --git-branch 11
|
||||
- ./travis.py frappe --socketio --tag v11 --tag-only
|
||||
- ./travis.py frappe --socketio --tag version-11 --tag-only
|
||||
|
||||
|
59
travis.py
Executable file
59
travis.py
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/env python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
parser = argparse.ArgumentParser(description='frappe_docker common CI elements', add_help=True)
|
||||
|
||||
parser.add_argument('service', action='store', type=str, help='Name of the service to build: "erpnext" or "frappe"')
|
||||
parser.add_argument('-o', '--tag-only', required=False, action='store_true', dest='tag_only', help='Only tag an image and push it.')
|
||||
|
||||
image_type = parser.add_mutually_exclusive_group(required=True)
|
||||
image_type.add_argument('-a', '--nginx', action='store_const', dest='image_type', const='nginx', help='Build the nginx + static assets image')
|
||||
image_type.add_argument('-s', '--socketio', action='store_const', dest='image_type', const='socketio', help='Build the frappe-socketio image')
|
||||
image_type.add_argument('-w', '--worker', action='store_const', dest='image_type', const='worker', help='Build the python environment image')
|
||||
|
||||
tag_type = parser.add_mutually_exclusive_group(required=True)
|
||||
tag_type.add_argument('-g', '--git-version', action='store', type=int, dest='version', help='The version number of --service (i.e. "11", "12", etc.)')
|
||||
tag_type.add_argument('-t', '--tag', action='store', type=str, dest='tag', help='The image tag (i.e. erpnext-worker:$TAG )')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
def git_version(service, version):
|
||||
print(f'Pulling {service} v{version}')
|
||||
subprocess.run(f'git clone https://github.com/frappe/{service} --branch version-{version}', shell=True)
|
||||
cd = os.getcwd()
|
||||
os.chdir(os.getcwd() + f'/{service}')
|
||||
subprocess.run('git fetch --tags', shell=True)
|
||||
version_tag = subprocess.check_output(f'git tag --list --sort=-version:refname "v{version}*" | sed -n 1p | sed -e \'s#.*@\(\)#\\1#\'', shell=True).strip().decode('ascii')
|
||||
os.chdir(cd)
|
||||
return version_tag
|
||||
|
||||
def build(service, tag, image, dockerfile):
|
||||
print(f'Building {service} {image} image using {dockerfile}')
|
||||
subprocess.run(f'docker build -t {service}-{image} -f build/{service}-{image}/{dockerfile} .', shell=True)
|
||||
tag_and_push(f'{service}-{image}', tag)
|
||||
|
||||
def tag_and_push(image_name, tag):
|
||||
print(f'Tagging {image_name} as "{tag}" and pushing')
|
||||
subprocess.run(f'docker tag {image_name} frappe/{image_name}:{tag}', shell=True)
|
||||
subprocess.run(f'docker push frappe/{image_name}:{tag}', shell=True)
|
||||
|
||||
def main():
|
||||
global tag
|
||||
global dockerfile
|
||||
|
||||
if args.version:
|
||||
tag = git_version(args.service, args.version)
|
||||
dockerfile = f'v{args.version}.Dockerfile'
|
||||
else:
|
||||
tag = args.tag
|
||||
dockerfile = 'Dockerfile'
|
||||
|
||||
if args.tag_only:
|
||||
tag_and_push(f'{args.service}-{args.image_type}', tag)
|
||||
else:
|
||||
build(args.service, tag, args.image_type, dockerfile)
|
||||
|
||||
main()
|
Loading…
Reference in New Issue
Block a user