Skip to content

Commit

Permalink
feat: build multi-architecture docker images (#268)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Efros <[email protected]>
  • Loading branch information
gilbsgilbs and powerman authored Feb 28, 2023
1 parent bfc3596 commit 608e20c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/CI&CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,28 @@ jobs:
restore-keys: |
v1-build-${{ runner.os }}-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Upload to DockerHub Container Registry
run: |
docker build -t "$(basename ${GITHUB_REPOSITORY,,})" .
docker login -u '${{ secrets.CR_USER }}' -p '${{ secrets.CR_PAT }}'
if echo "$GITHUB_REF" | grep -q '^refs/tags/v'; then
TAGS="${GITHUB_REF/refs\/tags\/v}"
TAG="${GITHUB_REF/refs\/tags\/v}"
else
#TAGS="$GITHUB_SHA latest"
TAGS="latest"
TAG="latest"
fi
for TAG in $TAGS; do
IMAGE_TAG="${{ secrets.CR_USER }}/$(basename ${GITHUB_REPOSITORY,,}):$TAG"
docker tag "$(basename ${GITHUB_REPOSITORY,,})" "$IMAGE_TAG"
docker push "$IMAGE_TAG"
done
IMAGE_TAG="${{ secrets.CR_USER }}/$(basename ${GITHUB_REPOSITORY,,}):${TAG}"
docker buildx build \
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x \
--tag "${IMAGE_TAG}" \
--push \
.
- run: echo -e "$GPG_KEY" | gpg --import
if: github.ref_type == 'tag'
Expand Down

0 comments on commit 608e20c

Please sign in to comment.