-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_release_radar.Dockerfile
40 lines (28 loc) · 1.17 KB
/
update_release_radar.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Edited from https://docs.aws.amazon.com/lambda/latest/dg/python-image.html#python-image-clients
# Define custom function directory
ARG FUNCTION_DIR="/function"
FROM python:3.12.0 as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Copy requirements
RUN mkdir -p ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}
COPY requirements.txt ${FUNCTION_DIR}
# Install the function's dependencies
RUN pip install --target ${FUNCTION_DIR} awslambdaric \
&& pip install --target ${FUNCTION_DIR} -r requirements.txt
# Copy function code
COPY . ${FUNCTION_DIR}
COPY .env ${LAMBDA_TASK_ROOT}
# Use a slim version of the base Python image to reduce the final image size
FROM python:3.12-slim
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Set working directory to function root directory
WORKDIR ${FUNCTION_DIR}
# Copy in the built dependencies
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
# Set runtime interface client as default command for the container runtime
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ]
# Pass the name of the function handler as an argument to the runtime
CMD [ "app.routines.update_release_radar.handler" ]