From c65393813f00cdc5a7a5cef6d5064b0ace0899e2 Mon Sep 17 00:00:00 2001 From: "Marc Burnie [AWS]" <mburnie@amazon.com> Date: Mon, 23 Dec 2024 21:11:53 +0000 Subject: [PATCH] AWS: Building multi-arch Alpine images --- provider/schema-aws/build-aws/Dockerfile | 14 +++++++++----- provider/schema-aws/build-aws/buildspec.yaml | 10 ++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/provider/schema-aws/build-aws/Dockerfile b/provider/schema-aws/build-aws/Dockerfile index 1da4d02de..8d0ec62a3 100644 --- a/provider/schema-aws/build-aws/Dockerfile +++ b/provider/schema-aws/build-aws/Dockerfile @@ -13,15 +13,19 @@ # limitations under the License. # https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html -FROM amazoncorretto:17 +FROM registry.repo.osdu.aws/amazoncorretto:17-alpine -RUN yum update -y && yum install -y shadow-utils \ - && groupadd -g 10001 -r appgroup \ - && useradd -M -g 10001 -r -u 10001 appuser +RUN apk update && \ + apk add --no-cache \ + bash \ + curl \ + shadow \ + && \ + /usr/sbin/groupadd -g 10001 -r appgroup && \ + /usr/sbin/useradd -M -g 10001 -r -u 10001 appuser ARG JAR_FILE=provider/schema-aws/target/*-spring-boot.jar - WORKDIR / COPY ${JAR_FILE} app.jar COPY /provider/schema-aws/build-aws/entrypoint.sh /entrypoint.sh diff --git a/provider/schema-aws/build-aws/buildspec.yaml b/provider/schema-aws/build-aws/buildspec.yaml index 6eca192fc..f969f48b1 100644 --- a/provider/schema-aws/build-aws/buildspec.yaml +++ b/provider/schema-aws/build-aws/buildspec.yaml @@ -101,12 +101,10 @@ phases: - echo "--Copying Helm Charts to ${OUTPUT_DIR:-dist}--" - rsync -r devops/aws/* "${OUTPUT_DIR:-dist}" - - echo "Building docker image..." - - docker build -f provider/schema-aws/build-aws/Dockerfile -t ${ECR_IMAGE} . - - docker tag ${ECR_IMAGE} ${ECR_IMAGE_BRANCH_LATEST} - - echo "Pushing docker image..." - - docker push ${ECR_IMAGE} - - docker push ${ECR_IMAGE_BRANCH_LATEST} + - echo "Build and push docker image..." + - docker buildx create --driver docker-container --use + - docker buildx inspect --bootstrap + - docker buildx build --platform linux/arm64/v8,linux/amd64 --pull --push -f provider/schema-aws/build-aws/Dockerfile -t ${ECR_IMAGE} -t ${ECR_IMAGE_BRANCH_LATEST} . - echo "Generate build-info.json" - | -- GitLab