Skip to content

Commit

Permalink
update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Mar 25, 2023
1 parent ee5eb59 commit a7d0715
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: pip install -r requirements.txt

- name: Build Docker images
run: python scripts/build.py
run: python scripts/build.py ${{ secrets.GITHUB_TOKEN }}

deploy:
needs: build
Expand Down
22 changes: 13 additions & 9 deletions scripts/build.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
#!/usr/bin/env python3

from pathlib import Path
from kubetools.docker_utils import build_and_push_img
import sys
from kubetools.docker_utils import build_and_push_client_img, build_and_push_server_img
from kubetools.ansible_utils import load_vars

root_directory = Path(__file__).parent.parent
data = load_vars(root_directory / '.ansible/vault_key', root_directory / 'vars/vault.yaml')
docker_username = data['docker_username']
docker_password = data['docker_password']
github_access_token = sys.argv[1]

build_and_push_img(
if not github_access_token:
print('GitHub access token is missing', flush=True, file=sys.stderr)
exit(1)

build_and_push_client_img(
src=root_directory / 'client',
docker_context_path=root_directory / 'client',
ignore=['node_modules', 'dist'],
tag_prefix='client',
image_name='mucsi96/training-log-pro-client',
docker_username=docker_username,
docker_password=docker_password
docker_password=docker_password,
github_access_token=github_access_token
)

build_and_push_img(
build_and_push_server_img(
src=root_directory / 'server',
docker_context_path=root_directory / 'server',
ignore=['target', 'dist'],
tag_prefix='server',
image_name='mucsi96/training-log-pro-server',
docker_username=docker_username,
docker_password=docker_password
docker_password=docker_password,
github_access_token=github_access_token
)

0 comments on commit a7d0715

Please sign in to comment.