Skip to content

Commit

Permalink
🐳 build arm64 images for other images
Browse files Browse the repository at this point in the history
Signed-off-by: Rintaro Okamura <[email protected]>
  • Loading branch information
rinx committed Oct 1, 2020
1 parent d76dc5a commit eea5545
Show file tree
Hide file tree
Showing 10 changed files with 660 additions and 295 deletions.
96 changes: 66 additions & 30 deletions .github/workflows/dockers-backup-manager-cassandra-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,50 +44,86 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
fetch-depth: 10
- name: Overwrite version name
if: github.event_name == 'pull_request'
run: |
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
echo "PR-${pr_num}" > versions/VALD_VERSION
- name: Build the Docker image
run: |
make docker/build/backup-manager-cassandra
env:
DOCKER_BUILDKIT: 1
- name: login to DockerHub
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Cache Docker layers (base)
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-base
key: ${{ runner.os }}-buildx-vald-base-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-base-
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-vald-manager-backup-cassandra-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-manager-backup-cassandra-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: push to DockerHub (master)
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Image name
id: image_name
run: |
image_name=`make docker/name/backup-manager-cassandra`
echo "::set-env name=IMAGE_NAME::${image_name}"
echo "::set-output name=IMAGE_NAME::${image_name}"
- name: Determine tag name (master)
if: github.ref == 'refs/heads/master'
run: |
imagename=`make docker/name/backup-manager-cassandra`
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
- name: push to DockerHub (pull request)
echo "::set-env name=PRIMARY_TAG::nightly"
- name: Determine tag name (pull request)
if: github.event_name == 'pull_request'
run: |
imagename=`make docker/name/backup-manager-cassandra`
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
docker tag ${imagename} ${imagename}:pr-${pr_num}
docker push ${imagename}:pr-${pr_num}
- name: push to DockerHub (tags)
echo "PR-${pr_num}" > versions/VALD_VERSION
echo "::set-env name=PRIMARY_TAG::pr-${pr_num}"
- name: Determine tag name (tags)
if: startsWith( github.ref, 'refs/tags/')
id: push_to_dockerhub_tags
id: determine_tag
run: |
imagename=`make docker/name/backup-manager-cassandra`
docker push ${imagename}:latest
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
docker tag ${imagename} ${imagename}:${tag_name}
docker push ${imagename}:${tag_name}
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
echo "::set-output name=IMAGE_NAME::${imagename}"
echo "::set-output name=TAG_NAME::${tag_name}"
echo "::set-env name=PRIMARY_TAG::${tag_name}"
- name: Build and Push
run: |
make \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/backup-manager-cassandra
make \
REPO="ghcr.io/vdaas/vald" \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/backup-manager-cassandra
env:
DOCKER_BUILDKIT: 1
PLATFORMS: linux/amd64,linux/arm64
BUILDER: ${{ steps.buildx.outputs.name }}
CACHE_OPTS: "--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,mode=max,dest=/tmp/.buildx-cache"
CACHE_OPTS_BASE: "--cache-from=type=local,src=/tmp/.buildx-cache-base"
LABEL_OPTS: "--label org.opencontainers.image.url=${{ github.event.repository.html_url }} --label org.opencontainers.image.source=${{ github.event.repository.html_url }} --label org.opencontainers.image.revision=${{ github.sha }}"
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v1
Expand Down
96 changes: 66 additions & 30 deletions .github/workflows/dockers-backup-manager-mysql-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,50 +42,86 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
fetch-depth: 10
- name: Overwrite version name
if: github.event_name == 'pull_request'
run: |
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
echo "PR-${pr_num}" > versions/VALD_VERSION
- name: Build the Docker image
run: |
make docker/build/backup-manager-mysql
env:
DOCKER_BUILDKIT: 1
- name: login to DockerHub
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Cache Docker layers (base)
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-base
key: ${{ runner.os }}-buildx-vald-base-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-base-
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-vald-manager-backup-mysql-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-manager-backup-mysql-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: push to DockerHub (master)
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Image name
id: image_name
run: |
image_name=`make docker/name/backup-manager-mysql`
echo "::set-env name=IMAGE_NAME::${image_name}"
echo "::set-output name=IMAGE_NAME::${image_name}"
- name: Determine tag name (master)
if: github.ref == 'refs/heads/master'
run: |
imagename=`make docker/name/backup-manager-mysql`
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
- name: push to DockerHub (pull request)
echo "::set-env name=PRIMARY_TAG::nightly"
- name: Determine tag name (pull request)
if: github.event_name == 'pull_request'
run: |
imagename=`make docker/name/backup-manager-mysql`
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
docker tag ${imagename} ${imagename}:pr-${pr_num}
docker push ${imagename}:pr-${pr_num}
- name: push to DockerHub (tags)
echo "PR-${pr_num}" > versions/VALD_VERSION
echo "::set-env name=PRIMARY_TAG::pr-${pr_num}"
- name: Determine tag name (tags)
if: startsWith( github.ref, 'refs/tags/')
id: push_to_dockerhub_tags
id: determine_tag
run: |
imagename=`make docker/name/backup-manager-mysql`
docker push ${imagename}:latest
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
docker tag ${imagename} ${imagename}:${tag_name}
docker push ${imagename}:${tag_name}
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
echo "::set-output name=IMAGE_NAME::${imagename}"
echo "::set-output name=TAG_NAME::${tag_name}"
echo "::set-env name=PRIMARY_TAG::${tag_name}"
- name: Build and Push
run: |
make \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/backup-manager-mysql
make \
REPO="ghcr.io/vdaas/vald" \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/backup-manager-mysql
env:
DOCKER_BUILDKIT: 1
PLATFORMS: linux/amd64,linux/arm64
BUILDER: ${{ steps.buildx.outputs.name }}
CACHE_OPTS: "--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,mode=max,dest=/tmp/.buildx-cache"
CACHE_OPTS_BASE: "--cache-from=type=local,src=/tmp/.buildx-cache-base"
LABEL_OPTS: "--label org.opencontainers.image.url=${{ github.event.repository.html_url }} --label org.opencontainers.image.source=${{ github.event.repository.html_url }} --label org.opencontainers.image.revision=${{ github.sha }}"
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v1
Expand Down
96 changes: 66 additions & 30 deletions .github/workflows/dockers-discoverer-k8s-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,50 +38,86 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
fetch-depth: 10
- name: Overwrite version name
if: github.event_name == 'pull_request'
run: |
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
echo "PR-${pr_num}" > versions/VALD_VERSION
- name: Build the Docker image
run: |
make docker/build/discoverer-k8s
env:
DOCKER_BUILDKIT: 1
- name: login to DockerHub
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Cache Docker layers (base)
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-base
key: ${{ runner.os }}-buildx-vald-base-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-base-
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-vald-discoverer-k8s-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-vald-discoverer-k8s-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: push to DockerHub (master)
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Image name
id: image_name
run: |
image_name=`make docker/name/discoverer-k8s`
echo "::set-env name=IMAGE_NAME::${image_name}"
echo "::set-output name=IMAGE_NAME::${image_name}"
- name: Determine tag name (master)
if: github.ref == 'refs/heads/master'
run: |
imagename=`make docker/name/discoverer-k8s`
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
- name: push to DockerHub (pull request)
echo "::set-env name=PRIMARY_TAG::nightly"
- name: Determine tag name (pull request)
if: github.event_name == 'pull_request'
run: |
imagename=`make docker/name/discoverer-k8s`
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
docker tag ${imagename} ${imagename}:pr-${pr_num}
docker push ${imagename}:pr-${pr_num}
- name: push to DockerHub (tags)
echo "PR-${pr_num}" > versions/VALD_VERSION
echo "::set-env name=PRIMARY_TAG::pr-${pr_num}"
- name: Determine tag name (tags)
if: startsWith( github.ref, 'refs/tags/')
id: push_to_dockerhub_tags
id: determine_tag
run: |
imagename=`make docker/name/discoverer-k8s`
docker push ${imagename}:latest
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
docker tag ${imagename} ${imagename}:${tag_name}
docker push ${imagename}:${tag_name}
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
echo "::set-output name=IMAGE_NAME::${imagename}"
echo "::set-output name=TAG_NAME::${tag_name}"
echo "::set-env name=PRIMARY_TAG::${tag_name}"
- name: Build and Push
run: |
make \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/discoverer-k8s
make \
REPO="ghcr.io/vdaas/vald" \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
DOCKER_OPTS_BASE="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS_BASE}" \
TAG="${PRIMARY_TAG}" \
docker/build/discoverer-k8s
env:
DOCKER_BUILDKIT: 1
PLATFORMS: linux/amd64,linux/arm64
BUILDER: ${{ steps.buildx.outputs.name }}
CACHE_OPTS: "--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,mode=max,dest=/tmp/.buildx-cache"
CACHE_OPTS_BASE: "--cache-from=type=local,src=/tmp/.buildx-cache-base"
LABEL_OPTS: "--label org.opencontainers.image.url=${{ github.event.repository.html_url }} --label org.opencontainers.image.source=${{ github.event.repository.html_url }} --label org.opencontainers.image.revision=${{ github.sha }}"
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v1
Expand Down
Loading

0 comments on commit eea5545

Please sign in to comment.