-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(container): Add initial APIs (#197)
* feat(container): Add initial APIs Signed-off-by: Kemal Akkoyun <[email protected]> * debug * Fix missed test case Signed-off-by: Kemal Akkoyun <[email protected]> * Add an allow list of keys Signed-off-by: Kemal Akkoyun <[email protected]> * Address review issues Signed-off-by: Kemal Akkoyun <[email protected]> * Disable tests until the feature landed on the backend Signed-off-by: Kemal Akkoyun <[email protected]> --------- Signed-off-by: Kemal Akkoyun <[email protected]> Co-authored-by: Ruslan Kuprieiev <[email protected]>
- Loading branch information
Showing
6 changed files
with
143 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ dmypy.json | |
|
||
/coverage.xml | ||
/.coverage | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class ContainerImage: | ||
"""ContainerImage represents a Docker image that can be built | ||
from a Dockerfile. | ||
""" | ||
|
||
_known_keys = {"dockerfile_str", "build_env", "build_args"} | ||
|
||
@classmethod | ||
def from_dockerfile_str(cls, text: str, **kwargs): | ||
# Check for unknown keys and return them as a dict. | ||
return dict( | ||
dockerfile_str=text, | ||
**{k: v for k, v in kwargs.items() if k in cls._known_keys}, | ||
) | ||
|
||
@classmethod | ||
def from_dockerfile(cls, path: str, **kwargs): | ||
with open(path) as fobj: | ||
return cls.from_dockerfile_str(fobj.read(), **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters