Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda-python): commands run non-sequentially on Graviton when building container image #22398

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions packages/@aws-cdk/aws-lambda-python/lib/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,30 @@ ARG PIP_INDEX_URL
ARG PIP_EXTRA_INDEX_URL
ARG HTTPS_PROXY

# Create a new location for the pip cache
# Ensure all users can write to pip cache
RUN mkdir /tmp/pip-cache && \
chmod -R 777 /tmp/pip-cache
# Add virtualenv path
ENV PATH="/usr/app/venv/bin:$PATH"

# set the cache location
# set the pip cache location
ENV PIP_CACHE_DIR=/tmp/pip-cache

# create a new virtualenv for python to use
# so that it isn't using root
RUN python -m venv /usr/app/venv
ENV PATH="/usr/app/venv/bin:$PATH"
# set the poetry cache
ENV POETRY_CACHE_DIR=/tmp/poetry-cache

RUN \
# create a new virtualenv for python to use
# so that it isn't using root
python -m venv /usr/app/venv && \
# Create a new location for the pip cache
mkdir /tmp/pip-cache && \
# Ensure all users can write to pip cache
chmod -R 777 /tmp/pip-cache && \
# Upgrade pip (required by cryptography v3.4 and above, which is a dependency of poetry)
RUN pip install --upgrade pip


# pipenv 2022.4.8 is the last version with Python 3.6 support
RUN pip install pipenv==2022.4.8 poetry

pip install --upgrade pip && \
# Create a new location for the poetry cache
mkdir /tmp/poetry-cache && \
# Ensure all users can write to poetry cache
RUN mkdir /tmp/poetry-cache && \
chmod -R 777 /tmp/poetry-cache

# set the poetry cache
ENV POETRY_CACHE_DIR=/tmp/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

CMD [ "python" ]