File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,8 @@ def deploy(self) -> Dict[str, str]:
156
156
stack_file = self ._create_temp_cdk_app ()
157
157
synth_command = f"npx cdk synth --app 'python { stack_file } ' -o { self ._cdk_out_dir } "
158
158
deploy_command = (
159
- f"npx cdk deploy --app '{ self ._cdk_out_dir } ' -O { self ._stack_outputs_file } --require-approval=never"
159
+ f"npx cdk deploy --app '{ self ._cdk_out_dir } ' -O { self ._stack_outputs_file } "
160
+ "--require-approval=never --method=direct"
160
161
)
161
162
162
163
# CDK launches a background task, so we must wait
Original file line number Diff line number Diff line change @@ -16,9 +16,16 @@ class LocalLambdaPowertoolsLayer(BaseLocalLambdaLayer):
16
16
17
17
def __init__ (self , output_dir : Path = CDK_OUT_PATH ):
18
18
super ().__init__ (output_dir )
19
- self .package = f"{ SOURCE_CODE_ROOT_PATH } [pydantic ]"
19
+ self .package = f"{ SOURCE_CODE_ROOT_PATH } [all ]"
20
20
self .build_args = "--platform manylinux1_x86_64 --only-binary=:all: --upgrade"
21
21
self .build_command = f"python -m pip install { self .package } { self .build_args } --target { self .target_dir } "
22
+ self .cleanup_command = (
23
+ f"rm -rf { self .target_dir } /boto* { self .target_dir } /s3transfer* && "
24
+ f"rm -rf { self .target_dir } /*dateutil* { self .target_dir } /urllib3* { self .target_dir } /six* && "
25
+ f"find { self .target_dir } -name '*.so' -type f -exec strip '{{}}' \; && " # noqa: W605
26
+ f"find { self .target_dir } -wholename '*/tests/*' -type f -delete && " # noqa: W605
27
+ f"find { self .target_dir } -regex '^.*\(__pycache__\|\.py[co]\)$' -delete" # noqa: W605
28
+ )
22
29
self .source_diff_file : Path = CDK_OUT_PATH / "layer_build.diff"
23
30
24
31
def build (self ) -> str :
@@ -31,6 +38,11 @@ def build(self) -> str:
31
38
32
39
return str (self .output_dir )
33
40
41
+ def after_build (self ):
42
+ subprocess .run (self .cleanup_command , shell = True )
43
+
44
+ super (LocalLambdaPowertoolsLayer , self ).after_build ()
45
+
34
46
def _has_source_changed (self ) -> bool :
35
47
"""Hashes source code and
36
48
You can’t perform that action at this time.
0 commit comments