forked from stoplightio/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stoplightio#1966 Adding Github Action for publishing multi-arch docke…
…r images on DockerHub Github action that triggers docker image build and publish action upon: * merging into master using tag :master * creating a new Prism Release with tags: latest, <major-version>, <full-version> Additionally adding YARN_NETWORK_TIMEOUT to Dockerfile with default value set to Yarn's default. This extra argument increases network timeout for arm64 Docker image builds since QEMU emulation tends to be slow.
- Loading branch information
Showing
2 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build & Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: [published] | ||
|
||
env: | ||
IS_RELEASE: ${{github.event_name == 'release'}} | ||
DOCKER_BUILD_ARGS: | | ||
BUILD_TYPE=production | ||
YARN_NETWORK_TIMEOUT=480000 | ||
DOCKER_BUILD_PLATFORMS: | | ||
linux/amd64 | ||
linux/arm64 | ||
jobs: | ||
docker-publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Compute release version tags | ||
if: env.IS_RELEASE == 'true' | ||
run: | | ||
echo "TAG_PRIMARY_VERSION=$(release='${{github.event.release.tag_name}}' && echo ${release:1:1})" >> $GITHUB_ENV | ||
echo "TAG_FULL_VERSION=$(release='${{github.event.release.tag_name}}' && echo ${release:1})" >> $GITHUB_ENV | ||
- | ||
name: Build and Push release tags | ||
if: env.IS_RELEASE == 'true' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
tags: | | ||
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, env.TAG_FULL_VERSION)}} | ||
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, env.TAG_PRIMARY_VERSION)}} | ||
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, 'latest')}} | ||
platforms: ${{env.DOCKER_BUILD_PLATFORMS}} | ||
build-args: ${{env.DOCKER_BUILD_ARGS}} | ||
- | ||
name: Build and Push master Tag | ||
if: env.IS_RELEASE != 'true' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
tags: | | ||
${{format('{0}/prism:master', secrets.DOCKERHUB_USERNAME)}} | ||
platforms: ${{env.DOCKER_BUILD_PLATFORMS}} | ||
build-args: ${{env.DOCKER_BUILD_ARGS}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters