Skip to content

Commit

Permalink
add arm support
Browse files Browse the repository at this point in the history
  • Loading branch information
l10178 committed Jan 29, 2021
1 parent eaa88b6 commit d0ff4bf
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,37 @@ jobs:
- name: Build
run: hugo --minify --baseURL /idaas-book

- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Login to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Setup qemu
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
- name: Setup buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Push image
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker buildx build \
--tag nxest/idaas-book:$VERSION \
--tag nxest/idaas-book:lastest \
--platform linux/amd64,linux/arm64 \
-f Dockerfile ./ \
--push

0 comments on commit d0ff4bf

Please sign in to comment.