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

add different platforms for docker img #417

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

Arturomtz8
Copy link
Contributor

I saw this issue and thought that it would be great for contributing to this project.

  • Made some modifications to docker.sh and to release.yaml
  • Breaking changes: no

tools/docker.sh Outdated
}


build_multiarch "$@"
Copy link

@danvergara danvergara Nov 3, 2024

Choose a reason for hiding this comment

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

Not sure if building the image for multiple architectures as the only option is the best solution.

Why don't you add the regular build as the default behavior in case the user doesn't have buildx installed or they don't pass any platform as a parameter?

Suggested change
build_multiarch "$@"
build_image "$@"

tools/docker.sh Outdated
Comment on lines 5 to 13
check_buildx(){
if docker buildx version &>/dev/null; then
return 0
fi
if docker buildx ls &>/dev/null; then
return 0
fi
return 1
}

Choose a reason for hiding this comment

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

When it comes to make sure if buildx is installed I'd recommend you this:

Suggested change
check_buildx(){
if docker buildx version &>/dev/null; then
return 0
fi
if docker buildx ls &>/dev/null; then
return 0
fi
return 1
}
check_buildx(){
docker buildx &>/dev/null
return @?
}

tools/docker.sh Outdated
}

build_multiarch() {
if ! check_buildx; then

Choose a reason for hiding this comment

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

Suggested change
if ! check_buildx; then
if check_buildx; then
echo "Building for platforms: $platforms"
# Build for each git tag and latest
for tag in latest $(git tag --points-at | sed s/^v//); do
docker buildx build \
--platform "$platforms" \
--tag raviqqe/muffet:$tag \
--push \
.
done
else
for tag in latest $(git tag --points-at | sed s/^v//); do
docker build -t raviqqe/muffet:$tag .
docker push raviqqe/muffet:$tag
done
fi

@@ -23,4 +23,4 @@ jobs:
with:
fetch-depth: 0
- run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- run: tools/docker.sh
- run: tools/docker.sh "linux/amd64,linux/arm64"

Choose a reason for hiding this comment

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

Also, check if the list of parameters is empty. if it is, go with the regular build.

@raviqqe raviqqe enabled auto-merge (squash) November 3, 2024 07:35
@raviqqe
Copy link
Owner

raviqqe commented Nov 3, 2024

Thank you for the changes!

I didn't expect any "users" of Muffet to use tools/docker.sh on their local machines but only for CI. So I'm gonna refactor the script as such later.

Copy link

codecov bot commented Nov 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.27%. Comparing base (61d5451) to head (9419f0a).
Report is 45 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #417      +/-   ##
==========================================
- Coverage   87.50%   87.27%   -0.23%     
==========================================
  Files          30       33       +3     
  Lines         872      927      +55     
==========================================
+ Hits          763      809      +46     
- Misses         88       94       +6     
- Partials       21       24       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@raviqqe raviqqe merged commit 1de7e0b into raviqqe:main Nov 3, 2024
8 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Nov 20, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [raviqqe/muffet](https://github.com/raviqqe/muffet) | patch | `v2.10.3` -> `v2.10.6` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>raviqqe/muffet (raviqqe/muffet)</summary>

### [`v2.10.6`](https://github.com/raviqqe/muffet/releases/tag/v2.10.6)

[Compare Source](raviqqe/muffet@v2.10.5...v2.10.6)

#### Changelog

-   [`467b32d`](raviqqe/muffet@467b32d) Bump version ([#&#8203;426](raviqqe/muffet#426))
-   [`9736341`](raviqqe/muffet@9736341) Push multiple tags at once ([#&#8203;425](raviqqe/muffet#425))

### [`v2.10.5`](https://github.com/raviqqe/muffet/releases/tag/v2.10.5)

[Compare Source](raviqqe/muffet@v2.10.4...v2.10.5)

#### Changelog

-   [`2c40527`](raviqqe/muffet@2c40527) Bump version ([#&#8203;424](raviqqe/muffet#424))
-   [`1ea2cb4`](raviqqe/muffet@1ea2cb4) Specify goreleaser configuration version ([#&#8203;423](raviqqe/muffet#423))

### [`v2.10.4`](https://github.com/raviqqe/muffet/releases/tag/v2.10.4)

[Compare Source](raviqqe/muffet@v2.10.3...v2.10.4)

#### Changelog

-   [`e7b1dce`](raviqqe/muffet@e7b1dce) Build Docker image for RISC-V ([#&#8203;419](raviqqe/muffet#419))
-   [`8196881`](raviqqe/muffet@8196881) Bump github.com/andybalholm/brotli from 1.1.0 to 1.1.1 ([#&#8203;415](raviqqe/muffet#415))
-   [`2e3a2af`](raviqqe/muffet@2e3a2af) Bump github.com/valyala/fasthttp from 1.55.0 to 1.56.0 ([#&#8203;411](raviqqe/muffet#411))
-   [`4e8bb9f`](raviqqe/muffet@4e8bb9f) Bump github.com/valyala/fasthttp from 1.56.0 to 1.57.0 ([#&#8203;416](raviqqe/muffet#416))
-   [`e8e6fe3`](raviqqe/muffet@e8e6fe3) Bump golang.org/x/net from 0.29.0 to 0.30.0 ([#&#8203;414](raviqqe/muffet#414))
-   [`ef0d500`](raviqqe/muffet@ef0d500) Bump version ([#&#8203;422](raviqqe/muffet#422))
-   [`2f60582`](raviqqe/muffet@2f60582) Disable Windows build ([#&#8203;421](raviqqe/muffet#421))
-   [`726091e`](raviqqe/muffet@726091e) Refactor Docker ([#&#8203;418](raviqqe/muffet#418))
-   [`3629f2c`](raviqqe/muffet@3629f2c) Try other platforms in Docker build ([#&#8203;420](raviqqe/muffet#420))
-   [`1de7e0b`](raviqqe/muffet@1de7e0b) add different platforms for docker img ([#&#8203;417](raviqqe/muffet#417))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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