<commit_before>from lib.git import clone_tmp
from lib.docker import build, push

ROUTE = '/push'
PORT = 4242

IMAGE_NAME = 'globidocker/github-hook'

def on_push(data):
    url = data['repository']['html_url']

    with clone_tmp(url) as repo:
        build(repo.path, IMAGE_NAME)
        push(IMAGE_NAME)<commit_msg>Now using docker-py in the repository hook Also using the new logger<commit_after>ROUTE = '/push'
PORT = 4242

IMAGE_NAME = 'globidocker/github-hook'

import docker

cli = docker.Client()

from lib.git import clone_tmp

def on_push(data, logger):
    url = data['repository']['html_url']

    logger.info('Cloning repository: "{}"...'.format(url))
    with clone_tmp(url) as repo:

        logger.info('Building image...')
        cli.build(repo.path, IMAGE_NAME)

        logger.info('Pushing image...')
        cli.push(IMAGE_NAME)

        logger.info('done')
{'fraction_non_alphanumeric': 0.13310580204778158, 'fraction_numerical': 0.009101251422070534, 'mean_word_length': 3.467005076142132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4779438', 'n_tokens_mistral': 303, 'n_tokens_neox': 284, 'n_words': 70}