Skip to content

Commit

Permalink
Support building extension images for alpine (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavl authored Aug 16, 2023
1 parent 4d9b829 commit e4e7b90
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions scripts/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
ARG TARGETARCH
COPY .layers/datadog_extension-$TARGETARCH-alpine/extensions/datadog-agent opt/extensions/datadog-agent
COPY --chmod=0755 scripts/datadog_wrapper opt/datadog_wrapper
13 changes: 10 additions & 3 deletions scripts/build_and_push_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
set -e

DOCKER_REPOSITORY_NAME="datadog/lambda-extension"
DOCKERFILE_LOCATION="scripts/Dockerfile"

# Move into the root directory, so this script can be called from any directory
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Expand All @@ -24,10 +23,18 @@ if [ -z "$VERSION" ]; then
fi

# Build the image, tagged with the version
echo "Building the Docker image, and pushing to Dockerhub"
echo "Building the non-alpine Docker image, and pushing to Dockerhub"
docker buildx build --platform linux/arm64,linux/amd64 \
-t $DOCKER_REPOSITORY_NAME:$VERSION \
-t $DOCKER_REPOSITORY_NAME:latest \
-f ./scripts/Dockerfile \
--build-arg EXTENSION_VERSION="${VERSION}" . \
--push
--push

echo "Building the alpine Docker image, and pushing to Dockerhub"
docker buildx build --platform linux/arm64,linux/amd64 \
-t $DOCKER_REPOSITORY_NAME:$VERSION-alpine \
-t $DOCKER_REPOSITORY_NAME:latest-alpine \
-f ./scripts/Dockerfile.alpine \
--build-arg EXTENSION_VERSION="${VERSION}" . \
--push
7 changes: 7 additions & 0 deletions scripts/build_binary_and_layer_dockerized.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,18 @@ if [ "$SERVERLESS_INIT" == "true" ]; then
elif [ "$ARCHITECTURE" == "amd64" ]; then
echo "Building for amd64 only"
docker_build_zip amd64
BUILD_FILE=Dockerfile.alpine.build
docker_build_zip amd64 -alpine
elif [ "$ARCHITECTURE" == "arm64" ]; then
echo "Building for arm64 only"
docker_build_zip arm64
BUILD_FILE=Dockerfile.alpine.build
docker_build_zip arm64 -alpine
else
echo "Building for both amd64 and arm64"
docker_build_zip amd64
docker_build_zip arm64
BUILD_FILE=Dockerfile.alpine.build
docker_build_zip amd64 -alpine
docker_build_zip arm64 -alpine
fi

0 comments on commit e4e7b90

Please sign in to comment.