mirror of
https://github.com/bilde2910/Hauk.git
synced 2026-01-23 02:24:09 +00:00
Add multiarch build hooks for Docker; see #65
This commit is contained in:
parent
86c4718055
commit
9340f78c6a
6 changed files with 36 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Autogenerated Dockerfiles
|
||||
/docker/Dockerfile.*
|
||||
8
hooks/build
Executable file
8
hooks/build
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Build main amd64 image
|
||||
docker build -f docker/Dockerfile.amd64 -t $IMAGE_NAME-amd64 -t $IMAGE_NAME .
|
||||
|
||||
# Build multiarch images
|
||||
docker build -f docker/Dockerfile.arm32v7 -t $IMAGE_NAME-arm32v7 .
|
||||
docker build -f docker/Dockerfile.arm64v8 -t $IMAGE_NAME-arm64v8 .
|
||||
6
hooks/post_checkout
Executable file
6
hooks/post_checkout
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Generate architecture-specific Dockerfiles
|
||||
for arch in amd64 arm32v7 arm64v8; do
|
||||
cat Dockerfile | sed -e "s/php:apache/${arch}\/php:apache/" > docker/Dockerfile.${arch}
|
||||
done
|
||||
10
hooks/post_push
Executable file
10
hooks/post_push
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Create manifest and annotate multiarch image
|
||||
docker manifest create $IMAGE_NAME $IMAGE_NAME-amd64 $IMAGE_NAME-arm32v7 $IMAGE_NAME-arm64v8
|
||||
docker manifest annotate $IMAGE_NAME $IMAGE_NAME-amd64 --os linux --arch amd64
|
||||
docker manifest annotate $IMAGE_NAME $IMAGE_NAME-arm32v7 --os linux --arch arm --variant v7
|
||||
docker manifest annotate $IMAGE_NAME $IMAGE_NAME-arm64v8 --os linux --arch arm64
|
||||
|
||||
# Replace image in registry
|
||||
docker manifest push --purge $IMAGE_NAME
|
||||
4
hooks/pre_build
Executable file
4
hooks/pre_build
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Set up QEMU for cross compilation
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
6
hooks/pre_push
Executable file
6
hooks/pre_push
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Push multiarch images
|
||||
for arch in amd64 arm32v7 arm64v8; do
|
||||
docker push $IMAGE_NAME-${arch}
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue