1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-02 22:33:05 +00:00

Create create_advlabdb_container

This commit is contained in:
Mo 2022-08-18 19:05:00 +02:00
parent 900049d410
commit 3b8f114788

View file

@ -179,6 +179,21 @@ def create_nginx_container():
)
# Needed for main and create_advlabdb_container
advlabdb_container_args = f"""--network {args.network} \
-e ADVLABDB_DATA_DIR=/volumes/data \
-v {ADVLABDB_REPO_DIR}:/volumes/repo:Z \
-v {ADVLABDB_DATA_DIR}:/volumes/data:Z \
-v {ADVLABDB_LOGS_DIR}:/volumes/logs:Z"""
def create_advlabdb_container():
create_container(
"advlabdb",
f"{advlabdb_container_args} localhost/advlabdb:latest",
)
def main():
pull_or_clone_repo()
@ -240,14 +255,8 @@ def main():
print(f"Making sure that the logs directory {ADVLABDB_LOGS_DIR} exists.")
ADVLABDB_LOGS_DIR.mkdir(parents=True, exist_ok=True)
container_args = f"""--network {args.network} \
-e ADVLABDB_DATA_DIR=/volumes/data \
-v {ADVLABDB_REPO_DIR}:/volumes/repo:Z \
-v {ADVLABDB_DATA_DIR}:/volumes/data:Z \
-v {ADVLABDB_LOGS_DIR}:/volumes/logs:Z"""
# Running setup commands (if needed)
run_manage = f"podman run -it --rm {container_args} localhost/advlabdb:latest python3 manage.py"
run_manage = f"podman run -it --rm {advlabdb_container_args} localhost/advlabdb:latest python3 manage.py"
commands = (
# Generate secret keys if secrets.ini does not exist yet
f"{run_manage} setup generate-secrets",
@ -258,10 +267,7 @@ def main():
for command in commands:
run(command, check=True)
create_container(
"advlabdb",
f"{container_args} localhost/advlabdb:latest",
)
create_advlabdb_container()
# Create Traefik container if needed