Skip to content

Commit

Permalink
Cache pip install in python Dockerfiles (#461)
Browse files Browse the repository at this point in the history
* Cache pip install in python Dockerfiles

* Update Dockerfile

* Update Dockerfile

* fix Dockerfile

---------

Co-authored-by: Mohamed Elasmar <[email protected]>
  • Loading branch information
mdavis-xyz and moelasmar authored Nov 7, 2023
1 parent 3d44a06 commit 9badf4c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.10

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.10 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM public.ecr.aws/lambda/python:3.10

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

# temporarily install gcc so that scikit-learn can be built
RUN yum install gcc-c++ -y

RUN python3.10 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.10

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.10 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.10

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.10 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.10

COPY app.py requirements.txt ./
COPY requirements.txt ./

RUN {{cookiecutter.runtime}} -m pip install -r requirements.txt -t .

COPY app.py ./

# Command can be overwritten by providing a different command in the template directly.
CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.11

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.11 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM public.ecr.aws/lambda/python:3.11

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

# temporarily install gcc so that scikit-learn can be built
RUN yum install gcc-c++ -y

RUN python3.11 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.11

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.11 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.11

COPY app.py requirements.txt ./
COPY model /opt/ml/model
COPY requirements.txt ./

RUN python3.11 -m pip install -r requirements.txt -t .

COPY model /opt/ml/model
COPY app.py ./

CMD ["app.lambda_handler"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM public.ecr.aws/lambda/python:3.11

COPY app.py requirements.txt ./
COPY requirements.txt ./

RUN {{cookiecutter.runtime}} -m pip install -r requirements.txt -t .

COPY app.py ./

# Command can be overwritten by providing a different command in the template directly.
CMD ["app.lambda_handler"]

0 comments on commit 9badf4c

Please sign in to comment.