mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
Only add --platform linux/amd64 in docker, not in podman
This commit is contained in:
parent
1d08e12f5e
commit
8757ff8296
1 changed files with 37 additions and 34 deletions
|
@ -73,22 +73,26 @@ def convert(input_filename, output_filename, ocr_lang, stdout_callback):
|
||||||
os.makedirs(pixel_dir, exist_ok=True)
|
os.makedirs(pixel_dir, exist_ok=True)
|
||||||
os.makedirs(safe_dir, exist_ok=True)
|
os.makedirs(safe_dir, exist_ok=True)
|
||||||
|
|
||||||
|
if container_tech == "docker":
|
||||||
|
platform_args = ["--platform", "linux/amd64"]
|
||||||
|
else:
|
||||||
|
platform_args = []
|
||||||
|
|
||||||
# Convert document to pixels
|
# Convert document to pixels
|
||||||
args = [
|
args = (
|
||||||
"run",
|
["run", "--network", "none"]
|
||||||
"--network",
|
+ platform_args
|
||||||
"none",
|
+ [
|
||||||
"--platform",
|
"-v",
|
||||||
"linux/amd64",
|
f"{input_filename}:/tmp/input_file",
|
||||||
"-v",
|
"-v",
|
||||||
f"{input_filename}:/tmp/input_file",
|
f"{pixel_dir}:/dangerzone",
|
||||||
"-v",
|
container_name,
|
||||||
f"{pixel_dir}:/dangerzone",
|
"/usr/bin/python3",
|
||||||
container_name,
|
"/usr/local/bin/dangerzone.py",
|
||||||
"/usr/bin/python3",
|
"document-to-pixels",
|
||||||
"/usr/local/bin/dangerzone.py",
|
]
|
||||||
"document-to-pixels",
|
)
|
||||||
]
|
|
||||||
ret = exec_container(args, stdout_callback)
|
ret = exec_container(args, stdout_callback)
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
print("documents-to-pixels failed")
|
print("documents-to-pixels failed")
|
||||||
|
@ -96,25 +100,24 @@ def convert(input_filename, output_filename, ocr_lang, stdout_callback):
|
||||||
# TODO: validate convert to pixels output
|
# TODO: validate convert to pixels output
|
||||||
|
|
||||||
# Convert pixels to safe PDF
|
# Convert pixels to safe PDF
|
||||||
args = [
|
args = (
|
||||||
"run",
|
["run", "--network", "none"]
|
||||||
"--network",
|
+ platform_args
|
||||||
"none",
|
+ [
|
||||||
"--platform",
|
"-v",
|
||||||
"linux/amd64",
|
f"{pixel_dir}:/dangerzone",
|
||||||
"-v",
|
"-v",
|
||||||
f"{pixel_dir}:/dangerzone",
|
f"{safe_dir}:/safezone",
|
||||||
"-v",
|
"-e",
|
||||||
f"{safe_dir}:/safezone",
|
f"OCR={ocr}",
|
||||||
"-e",
|
"-e",
|
||||||
f"OCR={ocr}",
|
f"OCR_LANGUAGE={ocr_lang}",
|
||||||
"-e",
|
container_name,
|
||||||
f"OCR_LANGUAGE={ocr_lang}",
|
"/usr/bin/python3",
|
||||||
container_name,
|
"/usr/local/bin/dangerzone.py",
|
||||||
"/usr/bin/python3",
|
"pixels-to-pdf",
|
||||||
"/usr/local/bin/dangerzone.py",
|
]
|
||||||
"pixels-to-pdf",
|
)
|
||||||
]
|
|
||||||
ret = exec_container(args, stdout_callback)
|
ret = exec_container(args, stdout_callback)
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
print("pixels-to-pdf failed")
|
print("pixels-to-pdf failed")
|
||||||
|
|
Loading…
Reference in a new issue