Skip to content
Snippets Groups Projects
Commit cdf109f157f1 authored by Georges Racinet's avatar Georges Racinet
Browse files

Docker push/pull script: made push optional

…and rewritten in Python for safe command line arguments
parsing.
parent 11ab298f4aa5
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
#!/usr/bin/env python3
import argparse
import subprocess
......@@ -2,3 +4,5 @@
TAG=testing
TAG="testing"
HEPTAPOD_REGISTRY_IMAGE="registry.heptapod.net:443/heptapod/omnibus-heptapod:" + TAG
TARGET_IMAGE="octobus/heptapod:" + TAG
......@@ -4,4 +8,8 @@
HEPTAPOD_REGISTRY_IMAGE=registry.heptapod.net:443/heptapod/omnibus-heptapod:$TAG
TARGET_IMAGE=octobus/heptapod:$TAG
parser = argparse.ArgumentParser(
description="Pull Heptapod image from registry.h.n and tag it "
"for Docker Hub and the launch script"
)
parser.add_argument("--push", help="Push to Docker Hub", action="store_true")
cl_args = parser.parse_args()
......@@ -7,4 +15,5 @@
docker pull $HEPTAPOD_REGISTRY_IMAGE
docker tag $HEPTAPOD_REGISTRY_IMAGE $TARGET_IMAGE
docker push $TARGET_IMAGE
subprocess.check_call(("docker", "pull", HEPTAPOD_REGISTRY_IMAGE))
subprocess.check_call(("docker", "tag", HEPTAPOD_REGISTRY_IMAGE, TARGET_IMAGE))
if cl_args.push:
subprocess.check_call(("docker", "push", TARGET_IMAGE))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment