Quantcast
Channel: Build Docker image from GitHub repository - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Build Docker image from GitHub repository

$
0
0

I'm trying to build docker image from a GitHub repository using docker api python client.

Here's what I have tried:From views.py

        if request.method == 'POST':        post_data = request.POST.copy()        post_data.update({'user': request.user.pk})        form = TarFromGithubForm(post_data)        if form.is_valid():            deployment = gitHubModel()            deployment.name = form.cleaned_data['name']            deployment.user = request.user            deployment.archive = form.cleaned_data['archive']            dpath = deployment.archive            print(deployment.archive)            deployment.save()            tag = deployment.name.lower()            client = docker.from_env()            client.images.build(path=dpath, tag=tag)            messages.success(request, 'Your deployment from github repository has been created successfully!')            return HttpResponseRedirect(reverse('users:deployments:repo'))

Here in archive input field user will provide github repository url.

it throws an error:

APIError at /user/deployment/new/github 500 Server Error: Internal Server Error ("error detecting content type for remote https://github.com/Abdul-Rehman-yousaf/testing: unsupported Content-Type "text/html; charset=utf-8"") Request Method: POST Request URL: http://127.0.0.1:8000/user/deployment/new/github Django Version: 1.11.3 Exception Type: APIError Exception Value:
500 Server Error: Internal Server Error ("error detecting content type for remote https://github.com/Abdul-Rehman-yousaf/testing: unsupported Content-Type "text/html; charset=utf-8"") Exception Location: /Users/abdul/IstioVirEnv/lib/python3.6/site-packages/docker/errors.py in create_api_error_from_http_exception, line 31 Python Executable: /Users/abdul/IstioVirEnv/bin/python Python Version: 3.6.1


Viewing all articles
Browse latest Browse all 2

Trending Articles