Skip to content

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

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 8, 2024

More betterer examples for more betterer exampling!

@johnstcn johnstcn self-assigned this Aug 8, 2024
Copy link
Member

@mafredri mafredri left a 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" {
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 😅

Copy link
Member

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!

Copy link
Member

@matifali matifali Aug 8, 2024

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?

Copy link
Member Author

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.

@johnstcn johnstcn merged commit 1926b0b into main Aug 8, 2024
14 checks passed
@johnstcn johnstcn deleted the cj/update-example branch August 8, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants