Skip to content

Instantly share code, notes, and snippets.

@zahmadsaleem
Created March 13, 2023 21:24
Show Gist options
  • Save zahmadsaleem/a1ff3e23acd1b306c161e7fcd60fb3c8 to your computer and use it in GitHub Desktop.
Save zahmadsaleem/a1ff3e23acd1b306c161e7fcd60fb3c8 to your computer and use it in GitHub Desktop.
Dockerfile to create a continer for AWS Lambda with ifcopenshell
# references: https://github.com/IfcOpenShell/IfcOpenShell/issues/2295#issuecomment-1219441082
ARG FUNCTION_DIR="/var/task"
FROM public.ecr.aws/docker/library/python:3.10 AS build
ARG IFC_OPENSHELL_BUILD="31-v0.7.0-cdde536"
RUN apt-get -y update && apt-get -y install unzip curl
ARG FUNCTION_DIR
RUN pip install --target ${FUNCTION_DIR} awslambdaric
RUN curl https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-${IFC_OPENSHELL_BUILD}-linux64.zip -O && \
unzip ifcopenshell-python-${IFC_OPENSHELL_BUILD}-linux64.zip && \
mv ifcopenshell ${FUNCTION_DIR} &&\
rm ifcopenshell-python-${IFC_OPENSHELL_BUILD}-linux64.zip
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY ./handlers ${FUNCTION_DIR}/handlers
WORKDIR ${FUNCTION_DIR}
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ]
CMD ["handlers.lambda_handler"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment