Skip to content

Commit

Permalink
changes to compile for linux/arm64 & Apple M1
Browse files Browse the repository at this point in the history
Signed-off-by: = <[email protected]>
  • Loading branch information
nebucaz committed Dec 8, 2021
1 parent d99bc4e commit df597fc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 17 deletions.
60 changes: 45 additions & 15 deletions make_node_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,24 @@
},
"python_version": PY_36_VERSION,
},
"1.12a": {
"path": "node-1.12",
"version": "node-1.12-4",
"args": {
# 1.16.0 nebucaz/indy-sdk -fork
"indy_sdk_url": "https://codeload.github.com/nebucaz/indy-sdk/tar.gz/65076801439ef2175e001bb408670b4924ca4347",
# 0.3.2
# https://codeload.github.com/hyperledger/ursa/tar.gz/d764981144bce9f5b0f1c085a8ebad222f429690
"ursa_url": "https://codeload.github.com/hyperledger/ursa/tar.gz/394bcdf1413ac41793e96175d46d745ed6ffd970",
"rocksdb_lib_ver":"5.13.fb",
"rust_version": "1.56.0",
},
"python_version": PY_36_VERSION,
},
}



parser = argparse.ArgumentParser(description="Generate a von-image Docker image")
parser.add_argument(
"-n", "--name", default=DEFAULT_NAME, help="the base name for the docker image"
Expand Down Expand Up @@ -131,6 +146,10 @@
build_args["python_version"] = py_ver
build_args["tag_name"] = tag_name
build_args["tag_version"] = tag_version

if args.platform:
build_args["platform"] = args.platform

if not args.debug:
build_args["indy_build_flags"] = "--release"
if args.build_arg:
Expand Down Expand Up @@ -172,7 +191,9 @@
cmd_args.extend(["--platform", args.platform])

cmd_args.append(target)
cmd = ["docker", "build"] + cmd_args
cmd = [
"docker",
"build"] + cmd_args

if args.dry_run:
print(" ".join(cmd))
Expand Down Expand Up @@ -215,22 +236,31 @@
print("Successfully tagged {}".format(s2i_tag))

if not args.dry_run:
if args.test or args.push:
if args.test:
#or args.push:
# error is thrown, when image is not in repo
test_path = target + "/Dockerfile.test"
test_tag = tag + "-test"
proc_bt = subprocess.run(
[
"docker",
"build",
"--build-arg",
"base_image=" + tag,
"-t",
test_tag,
"-f",
test_path,
target,
]
)

cmd_test_args = []
if args.platform:
cmd_test_args.extend(["--platform", args.platform])

cmd_args = []
#for k, v in build_args.items():
cmd_args.extend(["--build-arg", "base_image=" + tag])
cmd_args.extend(["-t", test_tag])
cmd_args.extend(["-f", test_path])

if args.platform:
cmd_args.extend(["--platform", args.platform])

cmd_args.append(target)
cmd_test = [
"docker",
"build"] + cmd_args

proc_bt = subprocess.run(cmd_test)
if proc_bt.returncode:
print("test image build failed")
sys.exit(1)
Expand Down
5 changes: 3 additions & 2 deletions node-1.12/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:18.04 as builder
ARG platform=linux/amd64
FROM --platform=${platform} ubuntu:18.04 as builder

ARG user=indy
ENV HOME="/home/$user"
Expand Down Expand Up @@ -157,7 +158,7 @@ RUN pip install --no-cache-dir -r requirements.txt


## Start fresh (new image) ##
FROM ubuntu:18.04
FROM --platform=${platform} ubuntu:18.04


ARG uid=1001
Expand Down

0 comments on commit df597fc

Please sign in to comment.