Skip to content

Commit

Permalink
Only pushing docker base images to registry when version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicz committed Jan 23, 2018
1 parent ddb9eff commit e4157bf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import distutils.cmd

import requests


class DeployDockerBasesCommand(distutils.cmd.Command):
""" A command that builds docker bases for the DockerBackend and deploys them to dockerhub.
Expand All @@ -15,11 +17,22 @@ def finalize_options(self):
pass

def run(self):
import arca
from arca import DockerBackend

backend = DockerBackend()
backend.check_docker_access()

response = requests.get(
"https://hub.docker.com/v2/repositories/mikicz/arca/tags/",
params={"page_size": 1000}
)
response = response.json()

if arca.__version__ in [x["name"] for x in response["results"]]:
print("This version was already pushed into the registry.")
return

base_arca_name, base_arca_tag = backend.get_arca_base(False)

print(f"Built image {base_arca_name}:{base_arca_tag}")
Expand Down

0 comments on commit e4157bf

Please sign in to comment.