docker-bookstack/generate.py

13 lines
No EOL
423 B
Python

#!/usr/bin/env python3
import sys
VERSION = sys.argv[1]
VERSION = VERSION[1:] if VERSION.lower().startswith("v") else VERSION
def do_substitution(input_filename: str, output_filename: str):
with open(input_filename) as f:
with open(output_filename, "w") as of:
of.write(f.read().replace("%s", VERSION))
do_substitution("Dockerfile.tpl", "Dockerfile")
do_substitution("README.md.tpl", "README.md")