Skip to content

docker image for python-gitlab #295

Closed

Description

@oupala

Is there a docker image for python-gitlab ?

If not, it could be a good thing to get python-gitlab available as a docker image.

Activity

  1. gpocentek commented on Aug 3, 2017

    @gpocentek
    Contributor

    Hi,

    I don't know if there's a python-gitlab image, but it's not something I want to maintain myself.

    If someone wants to do the initial work and make sure it is maintained, I'd be happy to host the code in the python-gitlab/ namespace.

  2. oupala commented on Aug 3, 2017

    @oupala
    Author

    Ok, if I succeed in making a working image, I will use it on a daily basis, so I'm sure I'll be maintaining it.

    So I'll get back on this issue once I get a working image.

  3. oupala commented on Aug 22, 2017

    @oupala
    Author

    The docker image is now ready.

    Here is the Dockerfile:

    FROM debian:stretch-slim
    
    # Install dependencies
    RUN apt update && \
        apt install -y \
          python-pip
    
    # Install python-gitlab
    RUN pip install --upgrade \
          python-gitlab
    
    # Copy sample configuration file
    COPY python-gitlab.cfg /python-gitlab/python-gitlab.cfg
    
    # Define the entrypoint that enable a configuration file
    ENTRYPOINT ["gitlab", "--config-file", "/python-gitlab/python-gitlab.cfg"]
    

    Here is the sample configuration file that I included in my own image via the COPY instruction (taken from the documentation):

    [global]
    default = somewhere
    ssl_verify = true
    timeout = 5
    api_version = 3
    
    [somewhere]
    url = https://some.whe.re
    private_token = vTbFeqJYCY3sibBP7BZM
    api_version = 4
    
    [elsewhere]
    url = http://else.whe.re:8080
    private_token = CkqsjqcQSFH5FQKDccu4
    timeout = 1
    

    You'll have to provide your own configuration file on the command line:

    docker run -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab/python-gitlab.cfg python-gitlab <my command>
    

    Which could lead to:

    docker run -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab/python-gitlab.cfg python-gitlab project list
    

    You can register this command as an alias:

    alias gitlab='docker run --rm -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab/python-gitlab.cfg python-gitlab'
    

    Which could lead to:

    gitlab project list
    

    I'm using this image successfully as CLI. There some more work to achieve in order to use the API.

    Could you please reopen the bug for the moment?

    And feel free to merge these materials within the git repository, or in another one. It would be greate to enable automatic build and publication to the docker hub.

  4. gpocentek commented on Aug 26, 2017

    @gpocentek
    Contributor

    Thanks for this Dockerfile. A couple questions about your choices:

    • Why not use a python base image? pip is already install and the images are very small
    • What about using /python-gitlab.cfg as config file? I don't see the point of having a subdirectory.
  5. gpocentek commented on Sep 2, 2017

    @gpocentek
    Contributor

    @oupala any feedback on the previous comment?

  6. oupala commented on Sep 19, 2017

    @oupala
    Author

    Sorry for the delay and thanks @gpocentek for your comments. You're right for both of them.

    I now use a python image, python:slim image. I also deleted the subdirectory. All is working well.

    Here is the Dockerfile:

    FROM python:slim
    
    # Install python-gitlab
    RUN pip install --upgrade python-gitlab
    
    # Copy sample configuration file
    COPY python-gitlab.cfg /
    
    # Define the entrypoint that enable a configuration file
    ENTRYPOINT ["gitlab", "--config-file", "/python-gitlab.cfg"]
    

    Here is the sample configuration file that I included in my own image via the COPY instruction (taken from the documentation):

    [global]
    default = somewhere
    ssl_verify = true
    timeout = 5
    api_version = 3
    
    [somewhere]
    url = https://some.whe.re
    private_token = vTbFeqJYCY3sibBP7BZM
    api_version = 4
    
    [elsewhere]
    url = http://else.whe.re:8080
    private_token = CkqsjqcQSFH5FQKDccu4
    timeout = 1
    

    You'll have to provide your own configuration file on the command line:

    docker run -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab.cfg python-gitlab <my command>
    

    Which could lead to:

    docker run -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab.cfg python-gitlab project list
    

    You can register this command as an alias:

    alias gitlab='docker run --rm -it -v /path/to/my/configuration/of/python-gitlab.cfg:/python-gitlab.cfg python-gitlab'
    

    Which could lead to:

    gitlab project list
    

    I'm using this image successfully as CLI. There some more work to achieve in order to use the API.

    Feel free to merge these materials within the git repository, or in another one. It would be greate to enable automatic build and publication to the docker hub.

  7. gpocentek commented on Nov 1, 2017

    @gpocentek
    Contributor

    @oupala Thanks for the update.

    I have limited time to work on python-gitlab so for now I don't want to add the docker image maintenance to my ToDo list. I've added your Dockerfile and a README to the source code to make it available to the world.

    Thank you!

  8. oupala commented on Nov 3, 2017

    @oupala
    Author

    Great! Thanks.

  9. locked as resolved and limited conversation to collaborators on Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions