mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Switched to using official Docker buildx action
This commit is contained in:
parent
91ff02db85
commit
42fc241561
80
.github/workflows/docker-build-and-push.yml
vendored
80
.github/workflows/docker-build-and-push.yml
vendored
|
|
@ -11,37 +11,53 @@ jobs:
|
||||||
BuildAndPush:
|
BuildAndPush:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
-
|
||||||
|
name: Checkout
|
||||||
- name: Set up buildx
|
uses: actions/checkout@v2
|
||||||
uses: crazy-max/ghaction-docker-buildx@v1
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
buildx-version: latest
|
username: ${{ env.DOCKER_HUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
- name: Log in to registry
|
-
|
||||||
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u $(echo "$DOCKER_HUB_USER") --password-stdin
|
name: Build temporary image
|
||||||
|
id: docker_build_temporary
|
||||||
- name: Build and push
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./build/docker/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: false
|
||||||
|
tags: ${{ env.DOCKER_HUB_USER }}/dendrite:latest
|
||||||
|
-
|
||||||
|
name: Build monolith image
|
||||||
|
id: docker_build_monolith
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./build/docker/Dockerfile.monolith
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.DOCKER_HUB_USER }}/dendrite-monolith:latest
|
||||||
|
-
|
||||||
|
name: Build polylith image
|
||||||
|
id: docker_build_polylith
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./build/docker/Dockerfile.polylith
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.DOCKER_HUB_USER }}/dendrite-polylith:latest
|
||||||
|
-
|
||||||
|
name: Image digest
|
||||||
run: |
|
run: |
|
||||||
# Build temporary builder image first and then use it to build monolith and polylith images
|
echo Monolith image digest - ${{ steps.docker_build_monolith.outputs.digest }}
|
||||||
for suffix in '' 'monolith' 'polylith'; do
|
echo Polylith image digest - ${{ steps.docker_build_polylith.outputs.digest }}
|
||||||
# Name of the repo/image
|
|
||||||
IMAGE_NAME=$DOCKER_HUB_USER/dendrite$(if [ $suffix != "" ]; then echo "-$suffix"; fi)
|
|
||||||
|
|
||||||
# Strip git ref prefix from version
|
|
||||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
||||||
|
|
||||||
# Use `latest` insted of `master`
|
|
||||||
[ "$VERSION" == "master" ] && VERSION=latest
|
|
||||||
|
|
||||||
# Ensure the whole tag is lowercase
|
|
||||||
IMAGE_NAME=$(echo $IMAGE_NAME | tr '[A-Z]' '[a-z]')
|
|
||||||
|
|
||||||
echo IMAGE_NAME=$IMAGE_NAME
|
|
||||||
echo VERSION=$VERSION
|
|
||||||
|
|
||||||
docker buildx build --push \
|
|
||||||
--file build/docker/Dockerfile$(if [ $suffix != "" ]; then echo ".$suffix"; fi) \
|
|
||||||
--tag $IMAGE_NAME:$VERSION \
|
|
||||||
--platform linux/amd64,linux/arm/v7,linux/arm64 .
|
|
||||||
done
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue