Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
c40536ca
Kaydet (Commit)
c40536ca
authored
Ock 09, 2017
tarafından
Thomas Schaaf
Kaydeden (comit)
Joffrey F
Şub 17, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implement cachefrom
Signed-off-by:
Thomas Schaaf
<
schaaf@komola.de
>
üst
123e430a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
build.py
docker/api/build.py
+10
-1
api_build_test.py
tests/integration/api_build_test.py
+18
-0
No files found.
docker/api/build.py
Dosyayı görüntüle @
c40536ca
...
...
@@ -18,7 +18,7 @@ class BuildApiMixin(object):
custom_context
=
False
,
encoding
=
None
,
pull
=
False
,
forcerm
=
False
,
dockerfile
=
None
,
container_limits
=
None
,
decode
=
False
,
buildargs
=
None
,
gzip
=
False
,
shmsize
=
None
,
labels
=
None
):
labels
=
None
,
cachefrom
=
None
):
"""
Similar to the ``docker build`` command. Either ``path`` or ``fileobj``
needs to be set. ``path`` can be a local path (to a directory
...
...
@@ -92,6 +92,7 @@ class BuildApiMixin(object):
shmsize (int): Size of `/dev/shm` in bytes. The size must be
greater than 0. If omitted the system uses 64MB.
labels (dict): A dictionary of labels to set on the image.
cachefrom (list): A list of images used for build cache resolution.
Returns:
A generator for the build output.
...
...
@@ -188,6 +189,14 @@ class BuildApiMixin(object):
'labels was only introduced in API version 1.23'
)
if
cachefrom
:
if
utils
.
version_gte
(
self
.
_version
,
'1.25'
):
params
.
update
({
'cachefrom'
:
json
.
dumps
(
cachefrom
)})
else
:
raise
errors
.
InvalidVersion
(
'cachefrom was only introduced in API version 1.25'
)
if
context
is
not
None
:
headers
=
{
'Content-Type'
:
'application/tar'
}
if
encoding
:
...
...
tests/integration/api_build_test.py
Dosyayı görüntüle @
c40536ca
...
...
@@ -153,6 +153,24 @@ class BuildTest(BaseAPIIntegrationTest):
info
=
self
.
client
.
inspect_image
(
'labels'
)
self
.
assertEqual
(
info
[
'Config'
][
'Labels'
],
labels
)
@requires_api_version
(
'1.25'
)
def
test_build_cachefrom
(
self
):
script
=
io
.
BytesIO
(
'
\n
'
.
join
([
'FROM scratch'
,
])
.
encode
(
'ascii'
))
cachefrom
=
[
'build1'
]
stream
=
self
.
client
.
build
(
fileobj
=
script
,
tag
=
'cachefrom'
,
cachefrom
=
cachefrom
)
self
.
tmp_imgs
.
append
(
'cachefrom'
)
for
chunk
in
stream
:
pass
info
=
self
.
client
.
inspect_image
(
'cachefrom'
)
self
.
assertEqual
(
info
[
'Config'
][
'CacheFrom'
],
cachefrom
)
def
test_build_stderr_data
(
self
):
control_chars
=
[
'
\x1b
[91m'
,
'
\x1b
[0m'
]
snippet
=
'Ancient Temple (Mystic Oriental Dream ~ Ancient Temple)'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment