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
523e6d48
Kaydet (Commit)
523e6d48
authored
Kas 11, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #846 from docker/838-update
Support for build arguments
üst
881e24c2
cefad9e2
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
build_test.py
tests/integration/build_test.py
+18
-0
No files found.
docker/api/build.py
Dosyayı görüntüle @
523e6d48
import
logging
import
logging
import
os
import
os
import
re
import
re
import
json
from
..
import
constants
from
..
import
constants
from
..
import
errors
from
..
import
errors
...
@@ -16,7 +17,7 @@ class BuildApiMixin(object):
...
@@ -16,7 +17,7 @@ class BuildApiMixin(object):
nocache
=
False
,
rm
=
False
,
stream
=
False
,
timeout
=
None
,
nocache
=
False
,
rm
=
False
,
stream
=
False
,
timeout
=
None
,
custom_context
=
False
,
encoding
=
None
,
pull
=
False
,
custom_context
=
False
,
encoding
=
None
,
pull
=
False
,
forcerm
=
False
,
dockerfile
=
None
,
container_limits
=
None
,
forcerm
=
False
,
dockerfile
=
None
,
container_limits
=
None
,
decode
=
False
):
decode
=
False
,
buildargs
=
None
):
remote
=
context
=
headers
=
None
remote
=
context
=
headers
=
None
container_limits
=
container_limits
or
{}
container_limits
=
container_limits
or
{}
if
path
is
None
and
fileobj
is
None
:
if
path
is
None
and
fileobj
is
None
:
...
@@ -71,6 +72,14 @@ class BuildApiMixin(object):
...
@@ -71,6 +72,14 @@ class BuildApiMixin(object):
}
}
params
.
update
(
container_limits
)
params
.
update
(
container_limits
)
if
buildargs
:
if
utils
.
version_gte
(
self
.
_version
,
'1.21'
):
params
.
update
({
'buildargs'
:
json
.
dumps
(
buildargs
)})
else
:
raise
errors
.
InvalidVersion
(
'buildargs was only introduced in API version 1.21'
)
if
context
is
not
None
:
if
context
is
not
None
:
headers
=
{
'Content-Type'
:
'application/tar'
}
headers
=
{
'Content-Type'
:
'application/tar'
}
if
encoding
:
if
encoding
:
...
...
tests/integration/build_test.py
Dosyayı görüntüle @
523e6d48
...
@@ -96,3 +96,21 @@ class BuildTest(api_test.BaseTestCase):
...
@@ -96,3 +96,21 @@ class BuildTest(api_test.BaseTestCase):
list
(
filter
(
None
,
logs
.
split
(
'
\n
'
))),
list
(
filter
(
None
,
logs
.
split
(
'
\n
'
))),
[
'not-ignored'
],
[
'not-ignored'
],
)
)
@requires_api_version
(
'1.21'
)
def
test_build_with_buildargs
(
self
):
script
=
io
.
BytesIO
(
'
\n
'
.
join
([
'FROM scratch'
,
'ARG test'
,
'USER $test'
])
.
encode
(
'ascii'
))
stream
=
self
.
client
.
build
(
fileobj
=
script
,
tag
=
'buildargs'
,
buildargs
=
{
'test'
:
'OK'
}
)
self
.
tmp_imgs
.
append
(
'buildargs'
)
for
chunk
in
stream
:
pass
info
=
self
.
client
.
inspect_image
(
'buildargs'
)
self
.
assertEqual
(
info
[
'Config'
][
'User'
],
'OK'
)
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