docker_build.py 1.28 KB
Newer Older
kladko's avatar
kladko committed
1 2
#!/usr/bin/env python

3
# Copyright (C) 2019-Present SKALE Labs
4
#
5
# This file is part of sgxwallet.
6
#
7 8 9 10
# sgxwallet is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
11
#
12 13 14 15
# sgxwallet is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
16
#
17 18
# You should have received a copy of the GNU Affero General Public License
# along with sgxwallet.  If not, see <https://www.gnu.org/licenses/>.
kladko's avatar
kladko committed
19
#
20
#    @file  docker_build.py
kladko's avatar
kladko committed
21
#    @author Stan Kladko
22
#    @date 2020
kladko's avatar
kladko committed
23 24 25
#

import sys, os, subprocess, time
26

kladko's avatar
kladko committed
27
os.chdir("..")
kladko's avatar
kladko committed
28
topDir = os.getcwd() + "/sgxwallet"
Oleh Nikolaiev's avatar
Oleh Nikolaiev committed
29 30 31 32
DOCKER_FILE_NAME = sys.argv[1]
IMAGE_NAME = sys.argv[2]
COMMIT_HASH = sys.argv[3]
TAG_POSTFIX = "latest_commit"
kladko's avatar
kladko committed
33

34
FULL_IMAGE_TAG = "skalenetwork/" + IMAGE_NAME + ":" + TAG_POSTFIX
kladko's avatar
kladko committed
35

Oleh Nikolaiev's avatar
Oleh Nikolaiev committed
36
print("Starting build", flush=True)
kladko's avatar
kladko committed
37

38
assert subprocess.call(["pwd"]) == 0
kladko's avatar
kladko committed
39

kladko's avatar
kladko committed
40
assert subprocess.call(["docker", "build", topDir, "--file", topDir + "/" + DOCKER_FILE_NAME, "--tag",
Oleh Nikolaiev's avatar
Oleh Nikolaiev committed
41
                        FULL_IMAGE_TAG]) == 0