Skip to content

Commit 6d4e261

Browse files
authored
Update Dockerfile
1 parent 3da84b2 commit 6d4e261

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Dockerfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
FROM public.ecr.aws/lambda/python:latest
1+
ARG FUNCTION_DIR="/function"
22

3-
COPY requirements.txt ./
4-
COPY lambda.py ./
3+
FROM python:3.11 as build-image
54

6-
RUN python3 -m pip install -r requirements.txt
5+
ARG FUNCTION_DIR
76

8-
ENV AWS_ACCESS_KEY_ID 000
9-
ENV AWS_SECRET_ACCESS_KEY 000
10-
ENV AWS_SESSION_TOKEN 000
7+
RUN mkdir -p ${FUNCTION_DIR}
8+
COPY lambda.py ${FUNCTION_DIR}
9+
COPY requirements.txt ${FUNCTION_DIR}
1110

12-
CMD ["lambda.lambda_handler"]
11+
RUN pip install --target ${FUNCTION_DIR} -r "${FUNCTION_DIR}/requirements.txt"
12+
RUN pip install --target ${FUNCTION_DIR} awslambdaric
13+
14+
FROM python:3.11-slim
15+
16+
ARG FUNCTION_DIR
17+
WORKDIR ${FUNCTION_DIR}
18+
19+
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
20+
21+
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ]
22+
CMD [ "lambda.handler" ]

0 commit comments

Comments
 (0)