diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2022-01-04 00:46:45 +0100 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-01-03 16:26:04 -0800 |
commit | 80754a17f66ef4cd8469ff0857e0fc592c89796d (patch) | |
tree | 63b457002aa739ee214bc18962b8ca9e2eb1b16b | |
parent | ca58008607385338aaedd14a58adc347fa1a41a0 (diff) | |
download | gitlab-80754a17f66ef4cd8469ff0857e0fc592c89796d.tar.gz |
feat(docker): remove custom entrypoint from image
This is no longer needed as all of the configuration
is handled by the CLI and can be passed as arguments.
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | README.rst | 38 | ||||
-rwxr-xr-x | docker-entrypoint.sh | 22 |
3 files changed, 26 insertions, 37 deletions
@@ -11,7 +11,6 @@ COPY --from=build /opt/python-gitlab/dist dist/ RUN pip install PyYaml RUN pip install $(find dist -name *.whl) && \ rm -rf dist/ -COPY docker-entrypoint.sh /usr/local/bin/ -ENTRYPOINT ["docker-entrypoint.sh"] +ENTRYPOINT ["gitlab"] CMD ["--version"] @@ -43,29 +43,41 @@ Install with pip pip install python-gitlab +Using the docker image +====================== -Using the python-gitlab docker image -==================================== +You can run the Docker image directly from the GitLab registry: -How to build ------------- +.. code-block:: console + + $ docker run -it --rm registry.gitlab.com/python-gitlab/python-gitlab:latest <command> ... + +For example, to get a project on GitLab.com (without authentication): + +.. code-block:: console -``docker build -t python-gitlab:TAG .`` + $ docker run -it --rm registry.gitlab.com/python-gitlab/python-gitlab:latest project get --id gitlab-org/gitlab -How to use ----------- +You can also mount your own config file: -``docker run -it --rm -e GITLAB_PRIVATE_TOKEN=<your token> -v /path/to/python-gitlab.cfg:/python-gitlab.cfg python-gitlab <command> ...`` +.. code-block:: console + + $ docker run -it --rm -v /path/to/python-gitlab.cfg:/etc/python-gitlab.cfg registry.gitlab.com/python-gitlab/python-gitlab:latest <command> ... + +Building the image +------------------ -or run it directly from the upstream image: +To build your own image from this repository, run: -``docker run -it --rm -e GITLAB_PRIVATE_TOKEN=<your token> -v /path/to/python-gitlab.cfg:/python-gitlab.cfg registry.gitlab.com/python-gitlab/python-gitlab:latest <command> ...`` +.. code-block:: console + + $ docker build -t python-gitlab:latest . -To change the GitLab URL, use `-e GITLAB_URL=<your url>` +Run your own image: -Bring your own config file: -``docker run -it --rm -v /path/to/python-gitlab.cfg:/python-gitlab.cfg -e GITLAB_CFG=/python-gitlab.cfg python-gitlab <command> ...`` +.. code-block:: console + $ docker run -it --rm -v python-gitlab:latest <command> ... Bug reports =========== diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100755 index 5835acd..0000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -GITLAB_CFG=${GITLAB_CFG:-"/etc/python-gitlab-default.cfg"} - -cat << EOF > /etc/python-gitlab-default.cfg -[global] -default = gitlab -ssl_verify = ${GITLAB_SSL_VERIFY:-true} -timeout = ${GITLAB_TIMEOUT:-5} -api_version = ${GITLAB_API_VERSION:-4} -per_page = ${GITLAB_PER_PAGE:-10} - -[gitlab] -url = ${GITLAB_URL:-https://gitlab.com} -private_token = ${GITLAB_PRIVATE_TOKEN} -oauth_token = ${GITLAB_OAUTH_TOKEN} -job_token = ${GITLAB_JOB_TOKEN} -http_username = ${GITLAB_HTTP_USERNAME} -http_password = ${GITLAB_HTTP_PASSWORD} -EOF - -exec gitlab --config-file "${GITLAB_CFG}" "$@" |