Skip to content

docker image for python-gitlab #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oupala opened this issue Aug 3, 2017 · 8 comments
Closed

docker image for python-gitlab #295

oupala opened this issue Aug 3, 2017 · 8 comments

Comments

@oupala
Copy link

oupala commented Aug 3, 2017

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.

@gpocentek
Copy link
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.

@oupala
Copy link
Author

oupala commented Aug 3, 2017

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.

@oupala
Copy link
Author

oupala commented Aug 22, 2017

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.

@gpocentek gpocentek reopened this Aug 25, 2017
@gpocentek
Copy link
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.

@gpocentek
Copy link
Contributor

@oupala any feedback on the previous comment?

@oupala
Copy link
Author

oupala commented Sep 19, 2017

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.

@gpocentek
Copy link
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!

@oupala
Copy link
Author

oupala commented Nov 3, 2017

Great! Thanks.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants