Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom image in easy install #1484

Merged
merged 3 commits into from
Sep 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions easy-install.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def check_repo_exists() -> bool:
return os.path.exists(os.path.join(os.getcwd(), "frappe_docker"))


def setup_prod(project: str, sites, email: str, version: str = None) -> None:
def setup_prod(project: str, sites, email: str, version: str = None, image = None) -> None:
if check_repo_exists():
compose_file_name = os.path.join(os.path.expanduser("~"), f"{project}-compose.yml")
docker_repo_path = os.path.join(os.getcwd(), "frappe_docker")
Expand All @@ -125,6 +125,11 @@ def setup_prod(project: str, sites, email: str, version: str = None) -> None:
admin_pass = ""
db_pass = ""
with open(compose_file_name, "w") as f:
if image:
filedata = f.read()
filedata = filedata.replace("image: frappe/erpnext", f"image: {image}")
f.write(filedata)

# Writing to compose file
if not os.path.exists(os.path.join(docker_repo_path, ".env")):
admin_pass = generate_pass()
Expand Down Expand Up @@ -199,7 +204,7 @@ def setup_prod(project: str, sites, email: str, version: str = None) -> None:
else:
install_docker()
clone_frappe_docker_repo()
setup_prod(project, sites, email, version) # Recursive
setup_prod(project, sites, email, version, image) # Recursive


def setup_dev_instance(project: str):
Expand Down Expand Up @@ -321,6 +326,7 @@ def create_site(
dest="sites",
)
parser.add_argument("-n", "--project", help="Project Name", default="frappe")
parser.add_argument("-i", "--image", help="Full Image Name")
parser.add_argument(
"--email", help="Add email for the SSL.", required="--prod" in sys.argv
)
Expand All @@ -338,6 +344,6 @@ def create_site(
if "example.com" in args.email:
cprint("Emails with example.com not acceptable", level=1)
sys.exit(1)
setup_prod(args.project, args.sites, args.email, args.version)
setup_prod(args.project, args.sites, args.email, args.version, args.image)
else:
parser.print_help()