Skip to content

Commit

Permalink
Github Actions with aarch64 building support
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyifan committed May 21, 2021
1 parent 5852d18 commit c9690d9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 30 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

workflow_dispatch:
schedule:
- cron: '45 2 * * 0'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: alpine
- image: centos
- image: debian
- image: fedora
- image: ubuntu
- image: archlinux

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: ./ci-helpers/build.sh
env:
IMAGE: ${{ matrix.image }}
SOURCE_IMAGE: ${{ matrix.source_image }}
SKIP_REMOVE: false
DOCKER_PUSH: "${{ github.ref == 'refs/heads/master' && '--push' || '' }}"
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

25 changes: 15 additions & 10 deletions travis-helpers/build-image.sh → ci-helpers/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ elif [[ $image == alpine ]]; then
EXTRA_CMD="RUN apk --update add bash tar && rm -rf /var/cache/apk/*"
fi

dockerfile=$(mktemp)
cat << EOF > $dockerfile
workdir=$(mktemp -d)
cp -r . $workdir
cat << EOF > $workdir/Dockerfile
FROM $source_image:$tag
LABEL maintainer "Yifan Gao <[email protected]>"
ENV ASSETS_DIR="/opt/smartentry/HEAD"
Expand All @@ -27,11 +28,15 @@ COPY smartentry.sh /sbin/smartentry.sh
ENTRYPOINT ["/sbin/smartentry.sh"]
CMD ["run"]
EOF
docker build -f $dockerfile -t smartentry/$image:$tag .
docker tag smartentry/$image:$tag smartentry/$image:$tag$version
[[ $SKIP_PUSH == true ]] || docker push smartentry/$image:$tag
[[ $SKIP_PUSH == true ]] || docker push smartentry/$image:$tag$version
[[ $SKIP_REMOVE == true ]] || docker rmi \
$source_image:$tag \
smartentry/$image:$tag \
smartentry/$image:$tag$version
cd $workdir
docker buildx build \
-t smartentry/$image:$tag \
--platform linux/amd64,linux/arm64 \
$DOCKER_PUSH .

[[ -n $version ]] && docker buildx build \
-t smartentry/$image:$tag$version \
--platform linux/amd64,linux/arm64 \
$DOCKER_PUSH .

[[ $SKIP_REMOVE == true ]] || docker buildx prune -a -f
File renamed without changes.

0 comments on commit c9690d9

Please sign in to comment.