Skip to content

Commit

Permalink
add different platforms for docker img (#417)
Browse files Browse the repository at this point in the history
I saw this [issue](#413) 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
  • Loading branch information
Arturomtz8 authored Nov 3, 2024
1 parent 4e8bb9f commit 1de7e0b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
31 changes: 27 additions & 4 deletions tools/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@

set -e

for tag in latest $(git tag --points-at | sed s/^v//); do
docker build -t raviqqe/muffet:$tag .
docker push raviqqe/muffet:$tag
done
check_buildx(){
docker buildx version &>/dev/null
return $?
}

build_image() {
local platforms=${1:-}
if [ ! -z "$platforms" ] && 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
}


build_image "$@"

0 comments on commit 1de7e0b

Please sign in to comment.