multiarch build for additional linux/arm64/v8 support (#292)
* multiarch build for additional linux/arm64/v8 and linux/arm/v7 support This commit fixes issue #291 * print logs of run command * drop arm/v7 for now (untested) * build arm64/v8 parallel during the build stage (without testing the image)
This commit is contained in:
parent
21b409863e
commit
afd62f33a0
59
.github/workflows/build-and-test.yaml
vendored
59
.github/workflows/build-and-test.yaml
vendored
@ -21,49 +21,65 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test:
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch : amd64
|
||||||
|
mode : build-and-test
|
||||||
|
- arch : arm64
|
||||||
|
variant : v8
|
||||||
|
mode : build-only
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
VOLUME : osm-db
|
VOLUME : osm-db
|
||||||
CONTAINER : osm-www
|
CONTAINER : osm-www
|
||||||
MOUNT : /data/database/
|
MOUNT : /data/database/
|
||||||
|
PLATFORM : linux/${{ matrix.arch }}${{ (matrix.variant != '' && format('/{0}', matrix.variant)) || '' }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
|
with:
|
||||||
|
platforms: ${{ matrix.arch }}
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
-
|
||||||
name: Environment
|
name: Environment
|
||||||
run : |
|
run : |
|
||||||
echo IMAGE=$(echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]') >>$GITHUB_ENV
|
echo IMAGE=$(echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]') >>$GITHUB_ENV
|
||||||
-
|
-
|
||||||
name: Docker build
|
name: Docker build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
pull : true
|
pull : true
|
||||||
load : true
|
load : ${{ matrix.mode == 'build-and-test' }}
|
||||||
|
platforms : ${{ env.PLATFORM }}
|
||||||
context : .
|
context : .
|
||||||
file : ./Dockerfile
|
file : ./Dockerfile
|
||||||
tags : ${{env.IMAGE}}:${{env.TAG}}
|
tags : ${{ env.IMAGE }}:${{ env.TAG }}
|
||||||
cache-from : type=gha,scope=${{ github.workflow }}
|
cache-from : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }}
|
||||||
cache-to : type=gha,scope=${{ github.workflow }},mode=max
|
cache-to : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }},mode=max
|
||||||
-
|
-
|
||||||
name: Import Luxembourg
|
name: Import Luxembourg
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
run : |
|
run : |
|
||||||
docker volume create ${VOLUME}
|
docker volume create ${VOLUME}
|
||||||
docker run --rm --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled ${IMAGE}:${TAG} import
|
docker run --rm --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled ${IMAGE}:${TAG} import
|
||||||
-
|
-
|
||||||
name: Start server
|
name: Start server
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
run : |
|
run : |
|
||||||
docker run --rm --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${IMAGE}:${TAG} run
|
docker run --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${IMAGE}:${TAG} run
|
||||||
sleep 30
|
sleep 30
|
||||||
|
docker logs ${CONTAINER}
|
||||||
-
|
-
|
||||||
name: Download tiles
|
name: Download tiles
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
run : |
|
run : |
|
||||||
curl http://localhost/tile/0/0/0.png --fail -o 000.png
|
curl http://localhost/tile/0/0/0.png --fail -o 000.png
|
||||||
curl http://localhost/tile/1/0/0.png --fail -o 100.png
|
curl http://localhost/tile/1/0/0.png --fail -o 100.png
|
||||||
@ -74,12 +90,14 @@ jobs:
|
|||||||
curl http://localhost/tile/18/135536/89345.png --fail -o example.png
|
curl http://localhost/tile/18/135536/89345.png --fail -o example.png
|
||||||
-
|
-
|
||||||
name: Upload tiles
|
name: Upload tiles
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: tiles
|
name: tiles
|
||||||
path: '*.png'
|
path: '*.png'
|
||||||
-
|
-
|
||||||
name: Verify tiles
|
name: Verify tiles
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
run : |
|
run : |
|
||||||
sha1sum *.png
|
sha1sum *.png
|
||||||
sha1sum --check <<EOF
|
sha1sum --check <<EOF
|
||||||
@ -100,6 +118,7 @@ jobs:
|
|||||||
done
|
done
|
||||||
-
|
-
|
||||||
name: Cleanup
|
name: Cleanup
|
||||||
|
if : ${{ matrix.mode == 'build-and-test' }}
|
||||||
run : |
|
run : |
|
||||||
docker rm --force --volumes ${CONTAINER}
|
docker rm --force --volumes ${CONTAINER}
|
||||||
docker volume rm --force ${VOLUME}
|
docker volume rm --force ${VOLUME}
|
||||||
@ -108,7 +127,7 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- test
|
- build
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
@ -122,7 +141,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.DOCKERHUB_IMAGE }}
|
${{ env.DOCKERHUB_IMAGE }}
|
||||||
@ -134,33 +153,37 @@ jobs:
|
|||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
|
with:
|
||||||
|
platforms: amd64,arm64
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
if: ${{ env.DOCKERHUB_IMAGE != '' }}
|
if: ${{ env.DOCKERHUB_IMAGE != '' }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
-
|
-
|
||||||
name: Login to GHCR
|
name: Login to GHCR
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry : ghcr.io
|
registry : ghcr.io
|
||||||
username : ${{ github.repository_owner }}
|
username : ${{ github.repository_owner }}
|
||||||
password : ${{ secrets.GITHUB_TOKEN }}
|
password : ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
pull : true
|
pull : true
|
||||||
push : true
|
push : true
|
||||||
|
platforms : linux/amd64,linux/arm64/v8
|
||||||
context : .
|
context : .
|
||||||
file : ./Dockerfile
|
file : ./Dockerfile
|
||||||
tags : ${{ steps.meta.outputs.tags }}
|
tags : ${{ steps.meta.outputs.tags }}
|
||||||
labels : ${{ steps.meta.outputs.labels }}
|
labels : ${{ steps.meta.outputs.labels }}
|
||||||
cache-from : type=gha,scope=${{ github.workflow }}
|
cache-from: |
|
||||||
cache-to : type=gha,scope=${{ github.workflow }},mode=max
|
type=gha,scope=${{ github.workflow }}:linux/amd64
|
||||||
|
type=gha,scope=${{ github.workflow }}:linux/arm64/v8
|
||||||
|
Loading…
Reference in New Issue
Block a user