-
Notifications
You must be signed in to change notification settings - Fork 265
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM debian:bookworm-slim | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
git | ||
|
||
ARG TARGETARCH | ||
ARG TARGETOS | ||
COPY spin-${TARGETOS}-${TARGETARCH} /usr/local/bin/spin | ||
|
||
ENTRYPOINT [ "/usr/local/bin/spin" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM gcr.io/distroless/static-debian12 | ||
|
||
ARG TARGETARCH | ||
ARG TARGETOS | ||
COPY spin-static-${TARGETOS}-${TARGETARCH} /usr/local/bin/spin | ||
|
||
ENTRYPOINT [ "/usr/local/bin/spin" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
needs: [build-and-sign, build-spin-static] | ||
permissions: | ||
contents: read | ||
packages: write | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
strategy: | ||
matrix: | ||
config: | ||
- { dockerfile: "Dockerfile", tag-suffix: "" } | ||
- { dockerfile: "distroless.Dockerfile", tag-suffix: "-distroless" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @vdice, just a curious question: does There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I do think distroless implies static by default. |
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup version info | ||
id: version | ||
run: | | ||
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then | ||
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "version=canary" >> $GITHUB_OUTPUT | ||
fi | ||
- name: download release assets | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: spin | ||
|
||
- name: extract binaries | ||
shell: bash | ||
run: | | ||
if [[ "${{ matrix.config.tag-suffix }}" == "-distroless" ]]; then | ||
static="-static" | ||
fi | ||
tar xvf spin-${{ steps.version.outputs.version }}${static}-linux-amd64.tar.gz | ||
mv spin spin${static}-linux-amd64 | ||
tar xvf spin-${{ steps.version.outputs.version }}${static}-linux-aarch64.tar.gz | ||
# Note: here we s/aarch64/arm64 to conform to Docker's TARGETARCH standards | ||
mv spin spin${static}-linux-arm64 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and Push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: .github/${{ matrix.config.dockerfile }} | ||
push: true | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}${{ matrix.config.tag-suffix }} |
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.
possibly use 22.04?
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 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.
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.
Yes 👍🏻 that makes sense. Thank you