-
Notifications
You must be signed in to change notification settings - Fork 4
chore: flesh out envbuilder_cached_image example #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
} | ||
|
||
// Start a local registry if no cache repo is specified. | ||
resource "docker_container" "registry" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dope!
name = "envbuilder-cached-image-example" | ||
image = envbuilder_cached_image.example.image | ||
env = envbuilder_cached_image.example.env | ||
network_mode = "host" # required to hit local registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩
network_mode = "host" | ||
lifecycle { | ||
// We want to persist this across invocations | ||
ignore_changes = all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a volume to persist the cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah I'm not keeping a volume here, it's just in-memory. It goes away with the registry, which makes this example easy to tidy up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine as an example of how it works I suppose, but it'll never hit the cache due to destruction 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, my bad, I thought the count was tied to workspace. NVM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it conflict with another workspace from the same template due to name
of the container being same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't meant to be copy-pasted into a template! It's just an example to illustrate how the provider works.
More betterer examples for more betterer exampling!