-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.py
43 lines (32 loc) · 1009 Bytes
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from invoke import task
from src.datascope.version import get_project_version
REPOSITORY = "eu.gcr.io/datascope-266618"
@task()
def container(ctx, version=None):
if not version:
version = get_project_version("src/package.json")
print(f"Building: {version}")
tag = f"{REPOSITORY}/datascope:{version}"
rsl = ctx.run(
f"docker build . -t {tag}",
echo=True
)
if rsl.failed:
print(rsl.stderr)
raise RuntimeError("Failed to build docker image")
print("Pushing")
rsl = ctx.run(
"docker push {}".format(tag),
echo=True,
pty=True
)
if rsl.failed:
print(rsl.stderr)
raise RuntimeError("Failed to push image tagged {}".format(tag))
@task()
def translations(ctx):
with ctx.cd("src"):
print("Make messages")
ctx.run("python manage.py makemessages --all", echo=True)
print("Compiling local messages")
ctx.run("python manage.py compilemessages", echo=True)