Fix building Docker image for arm and i386
This commit is contained in:
parent
8d0618fed9
commit
8d5eb56199
@ -46,6 +46,7 @@ jobs:
|
|||||||
environment:
|
environment:
|
||||||
IMAGE_ARCH: << parameters.image_arch >>
|
IMAGE_ARCH: << parameters.image_arch >>
|
||||||
PROGRAM: << parameters.program >>
|
PROGRAM: << parameters.program >>
|
||||||
|
BUILD_ID: << pipeline.number >>
|
||||||
command: |
|
command: |
|
||||||
if [ "$PROGRAM" = "frontend" ]; then
|
if [ "$PROGRAM" = "frontend" ]; then
|
||||||
export IMAGE_NAME="bird-lg-go"
|
export IMAGE_NAME="bird-lg-go"
|
||||||
@ -53,8 +54,13 @@ jobs:
|
|||||||
export IMAGE_NAME="bird-lgproxy-go"
|
export IMAGE_NAME="bird-lgproxy-go"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export IMAGE_ARCH_GO=$IMAGE_ARCH
|
||||||
|
if [ "$IMAGE_ARCH" = "i386" ]; then export IMAGE_ARCH_GO="386" ; fi
|
||||||
|
if [ "$IMAGE_ARCH" = "arm32v7" ]; then export IMAGE_ARCH_GO="arm" ; fi
|
||||||
|
if [ "$IMAGE_ARCH" = "arm64v8" ]; then export IMAGE_ARCH_GO="arm64"; fi
|
||||||
|
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg IMAGE_ARCH=$IMAGE_ARCH \
|
--build-arg IMAGE_ARCH=$IMAGE_ARCH_GO \
|
||||||
-t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \
|
-t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \
|
||||||
-f $PROGRAM/Dockerfile \
|
-f $PROGRAM/Dockerfile \
|
||||||
$PROGRAM
|
$PROGRAM
|
||||||
@ -63,12 +69,12 @@ jobs:
|
|||||||
|
|
||||||
# Tag image :{arch} and :{arch}-build{build number}
|
# Tag image :{arch} and :{arch}-build{build number}
|
||||||
docker push $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH
|
docker push $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH
|
||||||
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-build$CIRCLE_BUILD_NUM
|
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-circleci-build$BUILD_ID
|
||||||
docker push $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-build$CIRCLE_BUILD_NUM
|
docker push $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-circleci-build$BUILD_ID
|
||||||
if [ "$IMAGE_ARCH" = "amd64" ]; then
|
if [ "$IMAGE_ARCH" = "amd64" ]; then
|
||||||
# Tag as latest for amd64 images
|
# Tag as latest for amd64 images
|
||||||
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:latest
|
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:latest
|
||||||
docker push $DOCKER_USERNAME/$IMAGE_NAME:latest
|
docker push $DOCKER_USERNAME/$IMAGE_NAME:latest
|
||||||
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:build$CIRCLE_BUILD_NUM
|
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:circleci-build$BUILD_ID
|
||||||
docker push $DOCKER_USERNAME/$IMAGE_NAME:latest
|
docker push $DOCKER_USERNAME/$IMAGE_NAME:latest
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user