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

ci: use docker buildx in travis

This commit is contained in:
Revant Nandgaonkar 2021-01-07 19:37:46 +05:30
parent 948e1bf00a
commit 8d2c139fc6
9 changed files with 215 additions and 170 deletions

View File

@ -21,6 +21,8 @@ before_install:
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx create --use
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx inspect --bootstrap
- if [[ "$BUILD" != "development" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
@ -31,7 +33,6 @@ before_install:
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
sudo chmod +x /usr/local/bin/docker-compose;
fi
- chmod u+x ./travis.py
after_success:
- docker --version
@ -41,128 +42,244 @@ jobs:
- stage: "Build Frappe bench development environment (latest)"
if: branch = develop AND type != pull_request
script:
- docker build -t frappe/bench:latest -f build/bench/Dockerfile .
- docker push frappe/bench:latest
- stage: "Frappe (edge)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/bench:latest
-f build/bench/Dockerfile .
- stage: "Frappe Worker (edge)"
if: branch = develop AND type != pull_request
script:
- ./travis.py frappe --worker --tag latest
- ./travis.py frappe --worker --tag edge --tag-only
- ./travis.py frappe --worker --tag develop --tag-only
- stage: "Frappe (edge)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:latest
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (edge)"
if: branch = develop AND type != pull_request
script:
- ./travis.py frappe --nginx --tag latest
- ./travis.py frappe --nginx --tag edge --tag-only
- ./travis.py frappe --nginx --tag develop --tag-only
- stage: "Frappe (edge)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:latest
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (edge)"
if: branch = develop AND type != pull_request
script:
- ./travis.py frappe --socketio --tag latest
- ./travis.py frappe --socketio --tag edge --tag-only
- ./travis.py frappe --socketio --tag develop --tag-only
- stage: "ERPNext (edge)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:latest
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (edge)"
if: branch = develop AND type != pull_request
script:
- ./travis.py erpnext --worker --tag latest
- ./travis.py erpnext --worker --tag edge --tag-only
- ./travis.py erpnext --worker --tag develop --tag-only
- stage: "ERPNext (edge)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:latest
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (edge)"
if: branch = develop AND type != pull_request
script:
- ./travis.py erpnext --nginx --tag latest
- ./travis.py erpnext --nginx --tag edge --tag-only
- ./travis.py erpnext --nginx --tag develop --tag-only
- stage: "Frappe (v13-beta)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:edge
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:develop
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:latest
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v13-beta)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --worker --git-version 13-beta
- ./travis.py frappe --worker --tag v13-beta --tag-only
- ./travis.py frappe --worker --tag version-13-beta --tag-only
- stage: "Frappe (v13-beta)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v13-beta)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --nginx --git-version 13-beta
- ./travis.py frappe --nginx --tag v13-beta --tag-only
- ./travis.py frappe --nginx --tag version-13-beta --tag-only
- stage: "Frappe (v13-beta)"
- >
docker buildx build
--no-cache
--build-arg GIT_BRANCH=version-13-beta
--platform linux/amd64,linux/arm64
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v13-beta)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --socketio --git-version 13-beta
- ./travis.py frappe --socketio --tag v13-beta --tag-only
- ./travis.py frappe --socketio --tag version-13-beta --tag-only
- stage: "ERPNext (v13-beta)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v13-beta)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --worker --git-version 13-beta
- ./travis.py erpnext --worker --tag v13-beta --tag-only
- ./travis.py erpnext --worker --tag version-13-beta --tag-only
- stage: "ERPNext (v13-beta)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v13-beta)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --nginx --git-version 13-beta
- ./travis.py erpnext --nginx --tag v13-beta --tag-only
- ./travis.py erpnext --nginx --tag version-13-beta --tag-only
- stage: "Frappe (v12)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-13-beta
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v13
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v12)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --worker --git-version 12
- ./travis.py frappe --worker --tag v12 --tag-only
- ./travis.py frappe --worker --tag version-12 --tag-only
- stage: "Frappe (v12)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v12)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --nginx --git-version 12
- ./travis.py frappe --nginx --tag v12 --tag-only
- ./travis.py frappe --nginx --tag version-12 --tag-only
- stage: "Frappe (v12)"
- >
docker buildx build
--no-cache
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v12)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --socketio --git-version 12
- ./travis.py frappe --socketio --tag v12 --tag-only
- ./travis.py frappe --socketio --tag version-12 --tag-only
- stage: "ERPNext (v12)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v12)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --worker --git-version 12
- ./travis.py erpnext --worker --tag v12 --tag-only
- ./travis.py erpnext --worker --tag version-12 --tag-only
- stage: "ERPNext (v12)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v12)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --nginx --git-version 12
- ./travis.py erpnext --nginx --tag v12 --tag-only
- ./travis.py erpnext --nginx --tag version-12 --tag-only
- stage: "Frappe (v11)"
- docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-12
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v12
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- stage: "Frappe Worker (v11)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --worker --git-version 11
- ./travis.py frappe --worker --tag v11 --tag-only
- ./travis.py frappe --worker --tag version-11 --tag-only
- stage: "Frappe (v11)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-worker:${VERSION}
-f build/frappe-worker/Dockerfile .
- stage: "Frappe Nginx (v11)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --nginx --git-version 11
- ./travis.py frappe --nginx --tag v11 --tag-only
- ./travis.py frappe --nginx --tag version-11 --tag-only
- stage: "Frappe (v11)"
- >
docker buildx build
--no-cache
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg NODE_IMAGE_TAG=10-buster-slim
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-nginx:${VERSION}
-f build/frappe-nginx/Dockerfile .
- stage: "Frappe SocketIO (v11)"
if: branch = master AND type != pull_request
script:
- ./travis.py frappe --socketio --git-version 11
- ./travis.py frappe --socketio --tag v11 --tag-only
- ./travis.py frappe --socketio --tag version-11 --tag-only
- stage: "ERPNext (v11)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/frappe-socketio:${VERSION}
-f build/frappe-socketio/Dockerfile .
- stage: "ERPNext Worker (v11)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --worker --git-version 11
- ./travis.py erpnext --worker --tag v11 --tag-only
- ./travis.py erpnext --worker --tag version-11 --tag-only
- stage: "ERPNext (v11)"
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-worker:${VERSION}
-f build/erpnext-worker/Dockerfile .
- stage: "ERPNext Nginx (v11)"
if: branch = master AND type != pull_request
script:
- ./travis.py erpnext --nginx --git-version 11
- ./travis.py erpnext --nginx --tag v11 --tag-only
- ./travis.py erpnext --nginx --tag version-11 --tag-only
- >
docker buildx build
--platform linux/amd64,linux/arm64
--build-arg GIT_BRANCH=version-11
--build-arg NODE_IMAGE_TAG=10-buster-slim
--build-arg DOCKER_REGISTRY_PREFIX:=frappe=${DOCKER_REGISTRY_PREFIX:=frappe}
--push
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:v11
-t ${DOCKER_REGISTRY_PREFIX:=frappe}/erpnext-nginx:${VERSION}
-f build/erpnext-nginx/Dockerfile .
- stage: "Build and test edge images"
if: type = pull_request
before_install:

View File

@ -1,5 +1,5 @@
# Frappe Bench Dockerfile
FROM debian:stable-slim
FROM debian:buster-slim
LABEL author=frappé
RUN apt-get update -y && apt-get install \
@ -56,9 +56,11 @@ RUN apt-get update -y && apt-get install \
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales
# Install wkhtmltox correctly
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb
RUN dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb && rm wkhtmltox_0.12.5-1.buster_amd64.deb
# Detect arch, download and install wkhtmltox
RUN if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb
# Create new user with home directory, improve docker compatibility with UID/GID 1000, add user to sudo group, allow passwordless sudo, switch to that user and change directory to user home directory
RUN groupadd -g 1000 frappe

View File

@ -1,5 +1,6 @@
ARG NODE_IMAGE_TAG=12-buster-slim
ARG GIT_BRANCH=develop
ARG DOCKER_REGISTRY_PREFIX=frappe
FROM node:${NODE_IMAGE_TAG}
ARG GIT_BRANCH
@ -12,7 +13,7 @@ RUN chmod +x /install_app && \
RUN /install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}
FROM frappe/frappe-nginx:${GIT_BRANCH}
FROM ${DOCKER_REGISTRY_PREFIX}/frappe-nginx:${GIT_BRANCH}
COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/
COPY --from=0 /rsync /rsync

View File

@ -18,7 +18,6 @@ git clone --depth 1 ${APP_REPO} ${BRANCH} ${APP_NAME}
cd /home/frappe/frappe-bench/apps/frappe
yarn
yarn production --app ${APP_NAME}
rm -fr node_modules
yarn install --production=true
yarn add node-sass

View File

@ -1,5 +1,6 @@
ARG GIT_BRANCH=develop
FROM frappe/frappe-worker:${GIT_BRANCH}
ARG DOCKER_REGISTRY_PREFIX=frappe
FROM ${DOCKER_REGISTRY_PREFIX}/frappe-worker:${GIT_BRANCH}
ARG GIT_BRANCH
RUN install_app erpnext https://github.com/frappe/erpnext ${GIT_BRANCH}

View File

@ -29,7 +29,6 @@ RUN mkdir -p apps sites/assets/css \
RUN cd /home/frappe/frappe-bench/apps/frappe \
&& yarn \
&& yarn run production \
&& rm -fr node_modules \
&& yarn install --production=true
RUN node --version \

View File

@ -1,4 +1,4 @@
FROM node:slim
FROM node:buster-slim
# Add frappe user
RUN useradd -ms /bin/bash frappe

View File

@ -1,9 +1,7 @@
FROM python:3.7-slim-buster
# Add non root user without password
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS -1/' /etc/login.defs \
&& sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS -1/' /etc/login.defs \
&& useradd -ms /bin/bash frappe
RUN useradd -ms /bin/bash frappe
ARG GIT_BRANCH=develop
ARG ARCH=amd64
@ -20,7 +18,6 @@ RUN apt-get update -y && apt-get install \
postgresql-client \
gettext-base \
wget \
curl \
# for PDF
fonts-cantarell \
libffi-dev \
@ -39,13 +36,14 @@ RUN apt-get update -y && apt-get install \
libpq-dev \
wait-for-it \
# For arm64
gcc -y \
gcc \
g++ -y \
# Detect arch, download and install wkhtmltox
&& if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \
&& apt-get purge -y wget && apt-get autoremove -y \
&& chown -R frappe:frappe /home/frappe
USER frappe

View File

@ -1,72 +0,0 @@
#!/usr/bin/env python3
import argparse
import subprocess
import os
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('-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=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 )')
args = parser.parse_args()
return args
def git_version(service, version, branch):
print(f'Pulling {service} v{version}')
subprocess.run(f'git clone https://github.com/frappe/{service} --branch {branch}', shell=True)
cd = os.getcwd()
os.chdir(os.getcwd() + f'/{service}')
subprocess.run('git fetch --tags', shell=True)
# XX-beta becomes XX for tags search
version = version.split('-')[0]
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, branch):
build_args = f'--build-arg GIT_BRANCH={branch}'
if service == 'nginx' and branch == 'version-11':
build_args += f' --build-arg NODE_IMAGE_TAG=10-buster-slim'
print(f'Building {service} {image} image')
subprocess.run(f'docker buildx build --platform linux/amd64,linux/arm64 --load {build_args} -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():
args = parse_args()
tag = args.tag
branch = 'develop'
if args.version:
branch = 'version-' + args.version
tag = git_version(args.service, args.version, branch)
if args.tag_only:
tag_and_push(f'{args.service}-{args.image_type}', tag)
else:
build(args.service, tag, args.image_type, branch)
if __name__ == "__main__":
main()