Skip to content
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

feat(docker): add spin cli Dockerfiles; add build/push to release.yml #2700

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

vdice
Copy link
Contributor

@vdice vdice commented Aug 1, 2024

Adds Dockerfiles/CI for producing images wrapping the spin CLI on releases. These may be generally useful but were recently motivated by utilization in SpinKube. See #2677 for further motivation/discussion.

On a Spin release, the default image, eg ghcr.io/fermyon/spin:v2.8.0, has a Debian base (currently bookworm-slim) and includes the standard, dynamically-linked Spin binary, with a few utilities to enable further extension if desired (eg installing plugins). A smaller, distroless image is also produced, eg ghcr.io/fermyon/spin:v2.8.0-distroless, which bundles a statically-linked Spin binary for purposes when, say, only spin up --from ... is needed and further extensibility isn't required.

Here I've opted to pull in binaries built in the previous build steps, as opposed to attempting to (re)-run the build in the container itself. This cuts out potential headaches of debugging failed Docker builds and repurposes the same artifacts that are installed/run directly (sans container).

Closes #2677

@vdice vdice requested review from itowlson and calebschoepp August 1, 2024 17:08
Copy link
Collaborator

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these images be published already for me to test?

@vdice vdice force-pushed the feat/spin-docker-image branch from 99e9c26 to f07cd78 Compare August 14, 2024 10:30
@vdice
Copy link
Contributor Author

vdice commented Aug 14, 2024

Would these images be published already for me to test?

Yes: ghcr.io/vdice/spin:v2.7.0-vdice-test and ghcr.io/vdice/spin:v2.7.0-vdice-test-distroless

@vdice vdice force-pushed the feat/spin-docker-image branch from f07cd78 to a1da304 Compare August 14, 2024 15:29
Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
@vdice vdice force-pushed the feat/spin-docker-image branch from a1da304 to e34325a Compare August 14, 2024 15:31
Copy link
Collaborator

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried both of the images and they both worked on my draft spintainer PR. LGTM!

@@ -380,3 +380,80 @@ jobs:
repository: fermyon/homebrew-tap
event-type: spin-release
client-payload: '{"version": "${{ github.ref_name }}"}'

docker:
runs-on: "ubuntu-20.04"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly use 22.04?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose relegating to a follow-up; this is the version used elsewhere in the workflow so it might be nice to update all at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 👍🏻 that makes sense. Thank you

matrix:
config:
- { dockerfile: "Dockerfile", tag-suffix: "" }
- { dockerfile: "distroless.Dockerfile", tag-suffix: "-distroless" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vdice, just a curious question: does distroless means static implicitly?

Copy link
Contributor Author

@vdice vdice Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajatjindal Yes; well both. It uses a distroless base image and includes the static Spin binary. Open to alternative names... what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it is worth adding static to the name, if distroless implies static by default, then we can omit it. But otherwise it would be nice to call it out explicitly.

Copy link
Contributor Author

@vdice vdice Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I do think distroless implies static by default.

@vdice vdice requested a review from rajatjindal August 19, 2024 15:17
@vdice vdice merged commit e0e39a9 into spinframework:main Aug 20, 2024
17 checks passed
@vdice vdice deleted the feat/spin-docker-image branch August 20, 2024 08:47
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.

Spin Docker image
4 participants