diff --git a/Dockerfile b/Dockerfile index f3d144b..2da8f1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,8 +66,20 @@ RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3.us-we && chmod +x /usr/local/bin/kubectl /usr/local/bin/aws-iam-authenticator /usr/local/bin/ecs-cli /usr/local/bin/eksctl # Configure SSM & AWS CLI -RUN set -ex \ - && yum install -y https://s3.amazonaws.com/amazon-ssm-us-east-1/2.3.1644.0/linux_amd64/amazon-ssm-agent.rpm \ +# RUN set -ex \ +# && yum install -y https://s3.amazonaws.com/amazon-ssm-us-east-1/2.3.1644.0/linux_amd64/amazon-ssm-agent.rpm \ +# && unzip awscliv2.zip \ +# && ./aws/install + + +RUN ARCH=$(uname -m) \ + && if [ "$ARCH" = "aarch64" ]; then \ + yum install -y https://s3.amazonaws.com/amazon-ssm-region-name/latest/linux_arm64/amazon-ssm-agent.rpm; \ + elif [ "$ARCH" = "x86_64" ]; then \ + yum install -y https://s3.amazonaws.com/amazon-ssm-region-name/latest/linux_amd64/amazon-ssm-agent.rpm; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi \ && unzip awscliv2.zip \ && ./aws/install diff --git a/build.sh b/build.sh index 5ffb0ca..36e5904 100755 --- a/build.sh +++ b/build.sh @@ -38,6 +38,12 @@ else echo "AWS_ACCESS_KEY_ID=$(jq -r '.AccessKeyId' <<<$build_assume_role)" >> .env echo "AWS_SECRET_ACCESS_KEY=$(jq -r '.SecretAccessKey' <<<$build_assume_role)" >> .env echo "AWS_SESSION_TOKEN=$(jq -r '.Token' <<<$build_assume_role)" >> .env + + # Login to DockerHub if credentials are provided + if [ -n "$DOCKERHUB_USERNAME" ]; then + echo $DOCKERHUB_PASS | docker login --username $DOCKERHUB_USERNAME --password-stdin + fi + pack build ${build_image_name%:*}:latest \ --tag $build_image_name \ --env-file .env \