Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a8b1a0

Browse files
authored
Merge pull request#600 from hans-d/docker
more flexible docker
2 parentsea71f1d +756c73c commit3a8b1a0

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

‎contrib/docker/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM python:slim
1+
FROM python:alpine
22

3-
# Install python-gitlab
43
RUN pip install --upgrade python-gitlab
54

6-
# Copy sample configuration file
7-
COPY python-gitlab.cfg /
5+
COPY entrypoint-python-gitlab.sh /usr/local/bin/.
86

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"]

‎contrib/docker/README.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
python-gitlab docker image
22
==========================
33

4-
Dockerfile contributed by *oupala*:
5-
https://github.com/python-gitlab/python-gitlab/issues/295
6-
74
How to build
85
------------
96

10-
``docker build -tme/python-gitlab:VERSION .``
7+
``docker build -t python-gitlab:VERSION .``
118

129
How to use
1310
----------
1411

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> ...``
1619

17-
To make things easier you can create a shell alias:
1820

19-
``alias gitlab='docker run --rm -it -v /path/to/python-gitlab.cfg:/python-gitlab.cfg python-gitlab``
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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}"$@

‎contrib/docker/python-gitlab.cfg

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp