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

Commit384031c

Browse files
nejchJohnVillalovos
authored andcommitted
feat(docker): provide a Debian-based slim image
1 parentae7d3b0 commit384031c

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

‎.dockerignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
.tox/
2+
.venv/
13
venv/
24
dist/
35
build/
46
*.egg-info
7+
.coverage
58
.github/
9+
coverage.xml

‎.gitlab-ci.yml‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@ image: python:3.10
22

33
stages:
44
-deploy
5-
-deploy-latest
5+
-promote
66

7-
deploy_image:
7+
deploy-images:
88
stage:deploy
99
image:
1010
name:gcr.io/kaniko-project/executor:debug
1111
entrypoint:[""]
1212
script:
1313
-echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
14-
-/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
15-
only:
16-
-tags
14+
-executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-alpine
15+
-executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-slim-bullseye --build-arg PYTHON_FLAVOR=slim-bullseye
16+
rules:
17+
-if:$CI_COMMIT_TAG
1718

18-
deploy-latest:
19-
stage:deploy-latest
19+
tag-latest:
20+
stage:promote
2021
image:
2122
name:gcr.io/go-containerregistry/crane:debug
2223
entrypoint:[""]
2324
script:
24-
-mkdir /root/.docker && echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
25-
-/ko-app/crane cp $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest
26-
only:
27-
-tags
25+
-crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
26+
-crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-alpine ${CI_COMMIT_TAG}# /python-gitlab:v1.2.3
27+
-crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-alpine latest# /python-gitlab:latest
28+
-crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-alpine alpine# /python-gitlab:alpine
29+
-crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-slim-bullseye slim-bullseye# /python-gitlab:slim-bullseye
30+
rules:
31+
-if:$CI_COMMIT_TAG

‎Dockerfile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM python:3.10-alpine AS build
1+
ARG PYTHON_FLAVOR=alpine
2+
FROM python:3.10-${PYTHON_FLAVOR} AS build
23

34
WORKDIR /opt/python-gitlab
45
COPY . .
56
RUN python setup.py bdist_wheel
67

7-
FROM python:3.10-alpine
8+
FROM python:3.10-${PYTHON_FLAVOR}
89

910
WORKDIR /opt/python-gitlab
1011
COPY --from=build /opt/python-gitlab/dist dist/

‎README.rst‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,25 @@ From GitLab:
5353
$ pip install git+https://gitlab.com/python-gitlab/python-gitlab.git
5454
5555
56-
Using the docker image
57-
----------------------
56+
Using the docker images
57+
-----------------------
58+
59+
``python-gitlab`` provides Docker images in two flavors, based on the Alpine and Debian slim
60+
python `base images<https://hub.docker.com/_/python>`__. The default tag is ``alpine``,
61+
but you can explicitly use the alias (see below).
62+
63+
The alpine image is smaller, but you may want to use the Debian-based slim tag (currently
64+
based on ``-slim-bullseye``) if you are running into issues or need a more complete environment
65+
with a bash shell, such as in CI jobs.
66+
67+
The images are published on the GitLab registry, for example:
68+
69+
* ``registry.gitlab.com/python-gitlab/python-gitlab:latest`` (latest, alpine alias)
70+
* ``registry.gitlab.com/python-gitlab/python-gitlab:alpine`` (latest alpine)
71+
* ``registry.gitlab.com/python-gitlab/python-gitlab:slim-bullseye`` (latest slim-bullseye)
72+
* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0`` (alpine alias)
73+
* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0-alpine``
74+
* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0-slim-bullseye``
5875

5976
You can run the Docker image directly from the GitLab registry:
6077

@@ -89,6 +106,12 @@ Run your own image:
89106
90107
$ docker run -it --rm -v python-gitlab:latest <command> ...
91108
109+
Build a Debian slim-based image:
110+
111+
..code-block::console
112+
113+
$ docker build -t python-gitlab:latest --build-arg PYTHON_FLAVOR=slim-bullseye .
114+
92115
Bug reports
93116
-----------
94117

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp