From 6399a2508d57c7e0e53abb289b9abcadc312e5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jordan=20gonz=C3=A1lez?= <30836115+duncanista@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:45:52 -0500 Subject: [PATCH 1/2] update `Dockerfile` and `build_layers.sh` updated script to output directly on build, allowing me to run this locally and in a gitlab job --- Dockerfile | 5 ++++- scripts/build_layers.sh | 8 ++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2cf569a7..0c7f7204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG image -FROM $image +FROM $image as builder ARG runtime @@ -23,3 +23,6 @@ RUN find . -name '*.so' -exec strip -g {} \; RUN rm -rf ./python/lib/$runtime/site-packages/botocore* RUN rm -rf ./python/lib/$runtime/site-packages/setuptools RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests + +# FROM scratch +# COPY --from=builder /build/python / diff --git a/scripts/build_layers.sh b/scripts/build_layers.sh index ebd0eed3..9794f2bf 100755 --- a/scripts/build_layers.sh +++ b/scripts/build_layers.sh @@ -49,12 +49,8 @@ function docker_build_zip { --build-arg image=python:$1 \ --build-arg runtime=python$1 \ --platform linux/${arch} \ - --load - - # Run the image by runtime tag and copy the output /build/python to the temp dir - dockerId=$(docker create datadog-lambda-python-${arch}:$1) - docker cp $dockerId:/build/python $temp_dir/python - + --progress=plain \ + -o $temp_dir/python # Zip to destination, and keep directory structure as based in $temp_dir (cd $temp_dir && zip -q -r $destination ./) From 5e7d7a189000b7ad96e26c8518a5f8884601b509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jordan=20gonz=C3=A1lez?= <30836115+duncanista@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:49:16 -0500 Subject: [PATCH 2/2] uncomment needed changes --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c7f7204..a2da16f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,5 +24,5 @@ RUN rm -rf ./python/lib/$runtime/site-packages/botocore* RUN rm -rf ./python/lib/$runtime/site-packages/setuptools RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests -# FROM scratch -# COPY --from=builder /build/python / +FROM scratch +COPY --from=builder /build/python /