From 2fd169873afbb1ca8d5a46e03d2ba565b4e917a4 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 24 Aug 2023 20:44:31 +0100 Subject: [PATCH 1/4] correct docker image --- backend/docker/lambda.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/docker/lambda.Dockerfile b/backend/docker/lambda.Dockerfile index db9bad40..47d00c9d 100644 --- a/backend/docker/lambda.Dockerfile +++ b/backend/docker/lambda.Dockerfile @@ -3,7 +3,7 @@ # https://python-mip.readthedocs.io/en/latest/install.html # Pull base image -FROM arm64v8/python:3.10.12-slim-buster as build-image +FROM python:3.10.12-slim-buster as build-image # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 @@ -24,7 +24,7 @@ RUN pip install --upgrade pip \ RUN pip install awslambdaric # Second stage: "runtime-image" -FROM arm64v8/python:3.10.12-slim-buster +FROM python:3.10.12-slim-buster # Set work directory to the root of your project WORKDIR /var/task/Model From d6c29cc516e3302e4f3333d19fb4584ad9d35db1 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 24 Aug 2023 20:45:10 +0100 Subject: [PATCH 2/4] correct docker image --- backend/docker/lambda.Dockerfile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/docker/lambda.Dockerfile b/backend/docker/lambda.Dockerfile index 47d00c9d..f23435a0 100644 --- a/backend/docker/lambda.Dockerfile +++ b/backend/docker/lambda.Dockerfile @@ -1,7 +1,3 @@ -# Some additional work is required to get mip to run on arm64 architecture. -# This is because the mip library relies on the CBC solver, which is not available for arm64. -# https://python-mip.readthedocs.io/en/latest/install.html - # Pull base image FROM python:3.10.12-slim-buster as build-image @@ -10,17 +6,21 @@ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Set work directory to the root of your project -WORKDIR /var/task/Model +WORKDIR var/task/Model # Install system dependencies -# RUN apt-get update && apt-get install -y netcat-openbsd +RUN #apt-get update && apt-get install -y netcat-openbsd # Install python dependencies COPY ./backend/requirements/base.txt ./backend/requirements/base.txt -RUN pip install --upgrade pip \ - && pip install -r backend/requirements/base.txt && rm -rf /root/.cache +RUN pip install --upgrade pip +# Install and clean up temp caches +RUN pip install -r backend/requirements/base.txt && rm -rf /root/.cache -# Install the AWS Lambda RIC +# Since we are not using a base AWS image, there is some additional setup required. We need to set up the runtime +# interface client +# https://docs.aws.amazon.com/lambda/latest/dg/python-image.html#python-image-clients +# Additionally install the AWS Lambda RIC RUN pip install awslambdaric # Second stage: "runtime-image" @@ -48,4 +48,4 @@ COPY ./utils/ ./utils/ # Set the ENTRYPOINT to the AWS Lambda RIC and CMD to your function handler ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ] # Define the handler location -CMD ["backend.app.main.handler"] +CMD ["backend.app.main.handler"] \ No newline at end of file From a71bd53592eff050354de18551ca4850f6f1ea91 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 24 Aug 2023 20:46:12 +0100 Subject: [PATCH 3/4] correct docker image --- backend/docker/lambda.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/docker/lambda.Dockerfile b/backend/docker/lambda.Dockerfile index f23435a0..3931f0fc 100644 --- a/backend/docker/lambda.Dockerfile +++ b/backend/docker/lambda.Dockerfile @@ -9,7 +9,7 @@ ENV PYTHONUNBUFFERED 1 WORKDIR var/task/Model # Install system dependencies -RUN #apt-get update && apt-get install -y netcat-openbsd +#RUN apt-get update && apt-get install -y netcat-openbsd # Install python dependencies COPY ./backend/requirements/base.txt ./backend/requirements/base.txt From e8556ae60748bf6a9f772fc5bf8f492bdb7f08a8 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 24 Aug 2023 20:46:48 +0100 Subject: [PATCH 4/4] correct docker image --- backend/docker/lambda.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/docker/lambda.Dockerfile b/backend/docker/lambda.Dockerfile index 3931f0fc..168f94f6 100644 --- a/backend/docker/lambda.Dockerfile +++ b/backend/docker/lambda.Dockerfile @@ -13,9 +13,9 @@ WORKDIR var/task/Model # Install python dependencies COPY ./backend/requirements/base.txt ./backend/requirements/base.txt -RUN pip install --upgrade pip # Install and clean up temp caches -RUN pip install -r backend/requirements/base.txt && rm -rf /root/.cache +RUN pip install --upgrade pip \ + && pip install -r backend/requirements/base.txt && rm -rf /root/.cache # Since we are not using a base AWS image, there is some additional setup required. We need to set up the runtime # interface client