Describe your idea/feature/enhancement
[Project: sam init - python 3.8 - image container (not zip file)]
sam build always rebuild the image even if:
requirements.txt is not changed
- the code is not changed
Proposal
At least in development, we could change to Dockerfile to cache the layers that didn't changed, such as requirments.txt. When someone has a slow connection, it take A LOT of time.
In order to do this, the default Dockerfile should be changed in:
New Dockerfile
FROM public.ecr.aws/lambda/python:3.8 AS build
COPY requirements.txt ./
RUN python3.8 -m pip install -r requirements.txt -t .
COPY app.py ./
COPY model /opt/ml/model
CMD ["app.lambda_handler"]
Old Dockerfile
FROM public.ecr.aws/lambda/python:3.8
COPY app.py requirements.txt ./
COPY model /opt/ml/model
RUN python3.8 -m pip install -r requirements.txt -t .
CMD ["app.lambda_handler"]
Additional Details
Describe your idea/feature/enhancement
[Project:
sam init - python 3.8 - image container(not zip file)]sam buildalways rebuild the image even if:requirements.txtis not changedProposal
At least in development, we could change to Dockerfile to cache the layers that didn't changed, such as requirments.txt. When someone has a slow connection, it take A LOT of time.
In order to do this, the default Dockerfile should be changed in:
New
DockerfileOld
DockerfileAdditional Details