Skip to content

Commit e4e7b90

Browse files
authored
Support building extension images for alpine (#162)
1 parent 4d9b829 commit e4e7b90

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

scripts/Dockerfile.alpine

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM scratch
2+
ARG TARGETARCH
3+
COPY .layers/datadog_extension-$TARGETARCH-alpine/extensions/datadog-agent opt/extensions/datadog-agent
4+
COPY --chmod=0755 scripts/datadog_wrapper opt/datadog_wrapper

scripts/build_and_push_docker_image.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
set -e
1111

1212
DOCKER_REPOSITORY_NAME="datadog/lambda-extension"
13-
DOCKERFILE_LOCATION="scripts/Dockerfile"
1413

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

2625
# Build the image, tagged with the version
27-
echo "Building the Docker image, and pushing to Dockerhub"
26+
echo "Building the non-alpine Docker image, and pushing to Dockerhub"
2827
docker buildx build --platform linux/arm64,linux/amd64 \
2928
-t $DOCKER_REPOSITORY_NAME:$VERSION \
3029
-t $DOCKER_REPOSITORY_NAME:latest \
3130
-f ./scripts/Dockerfile \
3231
--build-arg EXTENSION_VERSION="${VERSION}" . \
33-
--push
32+
--push
33+
34+
echo "Building the alpine Docker image, and pushing to Dockerhub"
35+
docker buildx build --platform linux/arm64,linux/amd64 \
36+
-t $DOCKER_REPOSITORY_NAME:$VERSION-alpine \
37+
-t $DOCKER_REPOSITORY_NAME:latest-alpine \
38+
-f ./scripts/Dockerfile.alpine \
39+
--build-arg EXTENSION_VERSION="${VERSION}" . \
40+
--push

scripts/build_binary_and_layer_dockerized.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ if [ "$SERVERLESS_INIT" == "true" ]; then
8989
elif [ "$ARCHITECTURE" == "amd64" ]; then
9090
echo "Building for amd64 only"
9191
docker_build_zip amd64
92+
BUILD_FILE=Dockerfile.alpine.build
93+
docker_build_zip amd64 -alpine
9294
elif [ "$ARCHITECTURE" == "arm64" ]; then
9395
echo "Building for arm64 only"
9496
docker_build_zip arm64
97+
BUILD_FILE=Dockerfile.alpine.build
98+
docker_build_zip arm64 -alpine
9599
else
96100
echo "Building for both amd64 and arm64"
97101
docker_build_zip amd64
98102
docker_build_zip arm64
103+
BUILD_FILE=Dockerfile.alpine.build
104+
docker_build_zip amd64 -alpine
105+
docker_build_zip arm64 -alpine
99106
fi

0 commit comments

Comments
 (0)