Skip to content

Commit

Permalink
chore(lambda-python-alpha): make pipenv version a parameter for bundl…
Browse files Browse the repository at this point in the history
…ing (#32594)

Make pipenv version a parameter in the Dockerfile for python lambda bundling. It was originally hardcoded to 2022.4.8, which excluded newer features/fixes.

### Issue # (if applicable)

None.

### Reason for this change

Pipenv version was originally hardcoded to 2022.4.8, which excluded newer features/fixes. And that could not be changed without providing a new Dockerfile from scratch.

### Description of changes

Just made the pipenv version a new ARG in the Dockerfile. So that it can be provided from the outside.

It has the same default value as it used to have, so that the current behavior won't change.

### Describe any new or updated permissions being added

None

### Description of how you validated changes

Tested this same Dockerfile in my current project, providing the PIPENV_VERSION variable via CDK:

```typescript
import * as python from '@aws-cdk/aws-lambda-python-alpha';

const lambdaProps: python.PythonFunctionProps = {
  runtime: lambda.Runtime.PYTHON_3_11,
  // ...
  bundling: {
    buildArgs: {
      'PIPENV_VERSION': '2024.0.1',
    },
  }
};
```

### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
dil-emiravalles authored Feb 7, 2025
1 parent f6ed4be commit 7067c89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FROM $IMAGE
ARG PIP_INDEX_URL
ARG PIP_EXTRA_INDEX_URL
ARG HTTPS_PROXY
# pipenv 2022.4.8 is the last version with Python 3.6 support
ARG PIPENV_VERSION=2022.4.8
ARG POETRY_VERSION=1.5.1

# Add virtualenv path
Expand All @@ -31,8 +33,8 @@ RUN \
mkdir /tmp/poetry-cache && \
# Ensure all users can write to poetry cache
chmod -R 777 /tmp/poetry-cache && \
# pipenv 2022.4.8 is the last version with Python 3.6 support
pip install pipenv==2022.4.8 poetry==$POETRY_VERSION && \
# Install pipenv and poetry
pip install pipenv==$PIPENV_VERSION poetry==$POETRY_VERSION && \
# Ensure no temporary files remain in the caches
rm -rf /tmp/pip-cache/* /tmp/poetry-cache/*

Expand Down

0 comments on commit 7067c89

Please sign in to comment.