2022-06-17 03:07:30 +00:00
: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
***** ***** ***** ***
2023-02-13 09:59:02 +00:00
Create a :class: `~lightning.app.utilities.packaging.build_config.BuildConfig` and provide a **publicly accessible** link to where the image is hosted:
2022-06-17 03:07:30 +00:00
.. code-block :: python
2023-02-13 09:59:02 +00:00
from lightning.app import LightningWork, BuildConfig
2022-06-17 03:07:30 +00:00
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 ::
2022-11-07 20:00:54 +00:00
Custom docker images must have python installed. We'll use `virtualenv` from this system python to create a virtual environment.
We'll also configure the `virtualenv` to use the packages installed under system's python so your packages are not lost
2022-06-17 03:07:30 +00:00
----
***** ***** ***** ***** *
Provide a docker file
***** ***** ***** ***** *
.. note ::
Not yet supported. Coming soon.