Skip to content

Commit

Permalink
- Add docstring to facilitate doc generation for `fx workspace docker…
Browse files Browse the repository at this point in the history
…ize` command

- Rebased - 18/Nov/2024
- Updated as per latest code and comments
Signed-off-by: Shailesh Pant <shailesh.pant@intel.com>
  • Loading branch information
ishaileshpant committed Nov 18, 2024
1 parent a977fb3 commit 3ba1f82
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion openfl/interface/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,38 @@ def export_() -> str:
)
@pass_context
def dockerize_(context, save: bool, rebuild: bool, enclave_key: str, revision: str):
"""Package current workspace as a TEE-ready Docker image."""
"""
Package the current workspace as a Trusted Execution Environment (TEE)-ready Docker image.
This command exports the current workspace, builds an OpenFL base Docker image,
constructs the workspace Docker image, and optionally saves the workspace image as a tarball file.
Args:
context: The Click context object, representing the current command-line invocation context.
save (bool): If True, exports the Docker image as a `<workspace_name>.tar` file.
rebuild (bool): If True, rebuilds Docker images with the `--no-cache` option for a clean build.
enclave_key (str): Path to an enclave signing key. If not provided, a new key is auto-generated
within the workspace. Note that the key is not packaged with the image, allowing flexibility
to run without TEE later.
revision (str): Specifies the version of OpenFL source code to use when building the base Docker
image. Format: `<OPENFL_GIT_URL>@<COMMIT_ID/BRANCH>`. If not specified, the default value
in the `Dockerfile.base` is used, typically the latest stable release.
Steps Performed:
1. Exports the current workspace as an archive.
2. Builds the OpenFL base Docker image using the specified or default revision.
3. Builds the workspace Docker image, incorporating the exported workspace and signing key.
4. Optionally saves the workspace Docker image as a `.tar` file.
Raises:
FileNotFoundError: If the provided enclave key path does not exist.
RuntimeError: If any Docker commands fail during the build or export process.
Notes:
- If no enclave key is provided, a new one is generated using OpenSSL and saved in the workspace.
- The generated image is compatible with TEE environments but can be used outside of TEE if needed.
- Docker BuildKit is utilized for efficient and secure image builds.
"""
# Docker build options
options = []
options.append("--no-cache" if rebuild else "")
Expand Down

0 comments on commit 3ba1f82

Please sign in to comment.