constructs icon indicating copy to clipboard operation
constructs copied to clipboard

How to include some files/folders in packagePhpCode?

Open kevincerro opened this issue 8 months ago • 2 comments

Its currently possible to include files/folders which parent folder is excluded in CDK?

(include key is not valid)

const phpFpm = new PhpFpmFunction(this, 'web', {
    phpVersion: '8.4',
    handler: 'public/index.php',
    code: packagePhpCode(undefined, {
        exclude: ['public/assets'],
        include: ['public/assets/build/manifest.json'],
    }),
});

Working example in serverless.yml

package:
    patterns:
        # Excluded files and folders for deployment
        - '!public/**'
        # If you want to include files and folders that are part of excluded folders,
        # add them at the end
        - 'public/assets/build/entrypoints.json'
        - 'public/assets/build/manifest.json'

kevincerro avatar Apr 02 '25 22:04 kevincerro

Maybe is not possible because official AWS CDK don't have this option

https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-s3-assets.AssetOptions.html

kevincerro avatar Apr 02 '25 22:04 kevincerro

Yes (IIRC) 😕 I think there's an open issue in the CDK repository.

mnapoli avatar Apr 03 '25 08:04 mnapoli