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"]