From ba6276fb98cabed45bff4f5bcfc5402dc4c97c84 Mon Sep 17 00:00:00 2001 From: nishide-dev Date: Sat, 20 Apr 2024 18:41:26 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20change=20order=20of=20cre?= =?UTF-8?q?ating=20requirements.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/lambda/lambda.Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/lambda/lambda.Dockerfile b/docker/lambda/lambda.Dockerfile index c1a44ae..ac0eadc 100644 --- a/docker/lambda/lambda.Dockerfile +++ b/docker/lambda/lambda.Dockerfile @@ -1,14 +1,15 @@ FROM public.ecr.aws/docker/library/python:3.12.0-slim-bullseye -COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter -# コピーしてrequirements.txtを作成 +# requirements-dev.lockからrequirements.txtを生成 COPY requirements-dev.lock /tmp/requirements-dev.lock RUN sed '/^-e file:.*/d' /tmp/requirements-dev.lock > requirements.txt +# アプリコードをコピーする前に依存パッケージをインストール +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt + +COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter COPY . /app WORKDIR /app -# requirements.txtをインストール -RUN pip install -r requirements.txt --no-cache-dir - CMD ["python", "src/app.py"]