-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 1014 Bytes
/
Dockerfile
File metadata and controls
31 lines (23 loc) · 1014 Bytes
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
# Define global args
ARG FUNCTION_DIR="/function"
FROM public.ecr.aws/lambda/python:3.12 AS build_image
ARG FUNCTION_DIR
ENV BUILD_DIR=/hydrocron
RUN curl -sSL https://install.python-poetry.org | python3 -
WORKDIR $BUILD_DIR
COPY ./hydrocron ./hydrocron
COPY poetry.lock pyproject.toml README.md ./
RUN ~/.local/bin/poetry lock
RUN mkdir -p "${FUNCTION_DIR}" && \
~/.local/bin/poetry install --only main --sync && \
cp -r $(~/.local/bin/poetry env list --full-path | awk '{print $1}')/lib/python*/site-packages/* ${FUNCTION_DIR} && \
cp -r ./hydrocron ${FUNCTION_DIR} && \
touch ${FUNCTION_DIR}/hydrocron/__init__.py
COPY docker/docker-entrypoint.sh ${FUNCTION_DIR}/bin/docker-entrypoint.sh
RUN chmod 755 ${FUNCTION_DIR}/bin/docker-entrypoint.sh
FROM public.ecr.aws/lambda/python:3.12
ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
COPY --from=build_image ${FUNCTION_DIR} ${LAMBDA_TASK_ROOT}
ENV PATH="${PATH}:${LAMBDA_TASK_ROOT}/bin"
CMD [ "hydrocron.api.controllers.timeseries.lambda_handler" ]