File tree 4 files changed +35
-28
lines changed
4 files changed +35
-28
lines changed Original file line number Diff line number Diff line change 1
- FROM python:slim
1
+ FROM python:alpine
2
2
3
- # Install python-gitlab
4
3
RUN pip install --upgrade python-gitlab
5
4
6
- # Copy sample configuration file
7
- COPY python-gitlab.cfg /
5
+ COPY entrypoint-python-gitlab.sh /usr/local/bin/.
8
6
9
- # Define the entrypoint that enable a configuration file
10
- ENTRYPOINT ["gitlab" , "--config-file" , "/python-gitlab.cfg" ]
7
+ WORKDIR /src
8
+
9
+ ENTRYPOINT ["entrypoint-python-gitlab.sh" ]
10
+ CMD ["--version" ]
Original file line number Diff line number Diff line change 1
1
python-gitlab docker image
2
2
==========================
3
3
4
- Dockerfile contributed by *oupala *:
5
- https://github.com/python-gitlab/python-gitlab/issues/295
6
-
7
4
How to build
8
5
------------
9
6
10
- ``docker build -t me/ python-gitlab:VERSION . ``
7
+ ``docker build -t python-gitlab:VERSION . ``
11
8
12
9
How to use
13
10
----------
14
11
15
- ``docker run -it -v /path/to/python-gitlab.cfg:/python-gitlab.cfg python-gitlab <command> ... ``
12
+ ``docker run -it --rm -e GITLAB_PRIVATE_TOKEN=<your token> =/python-gitlab.cfg python-gitlab <command> ... ``
13
+
14
+ To change the endpoint, add `-e GITLAB_URL=<your url> `
15
+
16
+
17
+ Bring your own config file:
18
+ ``docker run -it --rm -v /path/to/python-gitlab.cfg:/python-gitlab.cfg -e GITLAB_CFG=/python-gitlab.cfg python-gitlab <command> ... ``
16
19
17
- To make things easier you can create a shell alias:
18
20
19
- ``alias gitlab='docker run --rm -it -v /path/to/python-gitlab.cfg:/python-gitlab.cfg python-gitlab ``
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ GITLAB_CFG=${GITLAB_CFG:- " /etc/python-gitlab-default.cfg" }
4
+
5
+ cat << EOF > /etc/python-gitlab-default.cfg
6
+ [global]
7
+ default = gitlab
8
+ ssl_verify = ${GITLAB_SSL_VERIFY:- true}
9
+ timeout = ${GITLAB_TIMEOUT:- 5}
10
+ api_version = ${GITLAB_API_VERSION:- 4}
11
+ per_page = ${GITLAB_PER_PAGE:- 10}
12
+
13
+ [gitlab]
14
+ url = ${GITLAB_URL:- https:// gitlab.com}
15
+ private_token = ${GITLAB_PRIVATE_TOKEN}
16
+ oauth_token = ${GITLAB_OAUTH_TOKEN}
17
+ http_username = ${GITLAB_HTTP_USERNAME}
18
+ http_password = ${GITLAB_HTTP_PASSWORD}
19
+ EOF
20
+
21
+ exec gitlab --config-file " ${GITLAB_CFG} " $@
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments