63 lines
1.9 KiB
ReStructuredText
63 lines
1.9 KiB
ReStructuredText
:orphan:
|
|
|
|
##############################
|
|
Build Configuration (Advanced)
|
|
##############################
|
|
|
|
**Audience:** Users who want full control over the docker image that is being installed in the cloud.
|
|
|
|
**Level:** Advanced
|
|
|
|
Advanced users who need full control over the environment a LightningWork runs in can specify a custom docker image that will be deployed in the cloud.
|
|
|
|
|
|
----
|
|
|
|
******************
|
|
Use a docker image
|
|
******************
|
|
|
|
Create a :class:`~lightning_app.utilities.packaging.build_config.BuildConfig` and provide a **publicly accessible** link to where the image is hosted:
|
|
|
|
.. code-block:: python
|
|
|
|
from lightning_app import LightningWork, BuildConfig
|
|
|
|
|
|
class MyWork(LightningWork):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
# Using a publicly hosted docker image:
|
|
self.cloud_build_config = BuildConfig(
|
|
# This is one of the base images Lightning uses by default
|
|
image="ghcr.io/gridai/base-images:v1.8-gpu"
|
|
)
|
|
|
|
# Can also be combined with extra requirements
|
|
self.cloud_build_config = BuildConfig(image="...", requirements=["torchmetrics"])
|
|
|
|
|
|
.. warning::
|
|
Many public hosters like DockerHub apply rate limits for public images. We recommend to pull images from your own registry.
|
|
For example, you can set up a
|
|
`docker registry on GitHub <https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry>`_.
|
|
|
|
|
|
.. note::
|
|
- The build config only applies when running in the cloud and gets ignored otherwise. A local build config is currently not supported.
|
|
- Images from private registries are currently not supported.
|
|
|
|
.. note::
|
|
Since we need to run the lightning framework in this image, it needs to have python and pip available.
|
|
|
|
----
|
|
|
|
|
|
*********************
|
|
Provide a docker file
|
|
*********************
|
|
|
|
.. note::
|
|
Not yet supported. Coming soon.
|