fix: erpnext image build
improve travis.py python packages not installed in editable mode use venv module instead of virtualenv
This commit is contained in:
parent
18e8f05c9f
commit
f5071122ed
@ -13,4 +13,4 @@ cd ./apps
|
|||||||
[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}"
|
[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}"
|
||||||
|
|
||||||
git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH}
|
git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH}
|
||||||
pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/${APP_NAME}
|
pip3 install --no-cache-dir /home/frappe/frappe-bench/apps/${APP_NAME}
|
@ -1,12 +1,12 @@
|
|||||||
ARG NODE_IMAGE_TAG=12-prod
|
ARG NODE_IMAGE_TAG=12-prod
|
||||||
|
ARG GIT_BRANCH=develop
|
||||||
FROM bitnami/node:${NODE_IMAGE_TAG}
|
FROM bitnami/node:${NODE_IMAGE_TAG}
|
||||||
|
|
||||||
|
ARG GIT_BRANCH
|
||||||
COPY build/erpnext-nginx/install_app.sh /install_app
|
COPY build/erpnext-nginx/install_app.sh /install_app
|
||||||
|
|
||||||
ARG GIT_BRANCH=develop
|
|
||||||
RUN /install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
|
RUN /install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
|
||||||
|
|
||||||
ARG GIT_BRANCH=develop
|
|
||||||
FROM frappe/frappe-nginx:${GIT_BRANCH}
|
FROM frappe/frappe-nginx:${GIT_BRANCH}
|
||||||
|
|
||||||
COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/
|
COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
ARG GIT_BRANCH=develop
|
ARG GIT_BRANCH=develop
|
||||||
FROM frappe/frappe-worker:${GIT_BRANCH}
|
FROM frappe/frappe-worker:${GIT_BRANCH}
|
||||||
|
|
||||||
ARG GIT_BRANCH=develop
|
ARG GIT_BRANCH
|
||||||
RUN install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
|
RUN install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
|
||||||
|
@ -32,11 +32,11 @@ RUN install_packages \
|
|||||||
RUN mkdir -p apps logs commands /home/frappe/backups
|
RUN mkdir -p apps logs commands /home/frappe/backups
|
||||||
|
|
||||||
# Setup python environment
|
# Setup python environment
|
||||||
RUN virtualenv env \
|
RUN python -m venv env \
|
||||||
&& . env/bin/activate \
|
&& . env/bin/activate \
|
||||||
&& cd apps \
|
&& cd apps \
|
||||||
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
|
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
|
||||||
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
|
&& pip3 install --no-cache-dir /home/frappe/frappe-bench/apps/frappe
|
||||||
|
|
||||||
# Copy scripts and templates
|
# Copy scripts and templates
|
||||||
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
|
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
|
||||||
|
32
travis.py
32
travis.py
@ -4,21 +4,24 @@ import argparse
|
|||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='frappe_docker common CI elements', add_help=True)
|
def parse_args():
|
||||||
|
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('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.')
|
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 = 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('-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('-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')
|
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 = parser.add_mutually_exclusive_group(required=True)
|
||||||
tag_type.add_argument('-g', '--git-version', action='store', type=str, dest='version', help='The version number of service (i.e. "11", "12", etc.)')
|
tag_type.add_argument('-g', '--git-version', action='store', type=str, 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 )')
|
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()
|
||||||
|
return args
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
def git_version(service, version, branch):
|
def git_version(service, version, branch):
|
||||||
print(f'Pulling {service} v{version}')
|
print(f'Pulling {service} v{version}')
|
||||||
@ -34,6 +37,7 @@ def git_version(service, version, branch):
|
|||||||
os.chdir(cd)
|
os.chdir(cd)
|
||||||
return version_tag
|
return version_tag
|
||||||
|
|
||||||
|
|
||||||
def build(service, tag, image, branch):
|
def build(service, tag, image, branch):
|
||||||
build_args = f'--build-arg GIT_BRANCH={branch}'
|
build_args = f'--build-arg GIT_BRANCH={branch}'
|
||||||
if service == 'nginx' and branch == 'version-11':
|
if service == 'nginx' and branch == 'version-11':
|
||||||
@ -43,12 +47,15 @@ def build(service, tag, image, branch):
|
|||||||
subprocess.run(f'docker build {build_args} -t {service}-{image} -f build/{service}-{image}/Dockerfile .', shell=True)
|
subprocess.run(f'docker build {build_args} -t {service}-{image} -f build/{service}-{image}/Dockerfile .', shell=True)
|
||||||
tag_and_push(f'{service}-{image}', tag)
|
tag_and_push(f'{service}-{image}', tag)
|
||||||
|
|
||||||
|
|
||||||
def tag_and_push(image_name, tag):
|
def tag_and_push(image_name, tag):
|
||||||
print(f'Tagging {image_name} as "{tag}" and pushing')
|
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 tag {image_name} frappe/{image_name}:{tag}', shell=True)
|
||||||
subprocess.run(f'docker push frappe/{image_name}:{tag}', shell=True)
|
subprocess.run(f'docker push frappe/{image_name}:{tag}', shell=True)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
args = parse_args()
|
||||||
tag = args.tag
|
tag = args.tag
|
||||||
branch = 'develop'
|
branch = 'develop'
|
||||||
|
|
||||||
@ -61,4 +68,5 @@ def main():
|
|||||||
else:
|
else:
|
||||||
build(args.service, tag, args.image_type, branch)
|
build(args.service, tag, args.image_type, branch)
|
||||||
|
|
||||||
main()
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user