Skip to content

Instantly share code, notes, and snippets.

@joshatxantie
Created December 1, 2021 14:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshatxantie/bdd29cd16796026495426dce3ff2bb43 to your computer and use it in GitHub Desktop.
Save joshatxantie/bdd29cd16796026495426dce3ff2bb43 to your computer and use it in GitHub Desktop.
AWS Lambda Container Image for Python and PYODBC
FROM public.ecr.aws/lambda/python:3.9
COPY . ${LAMBDA_TASK_ROOT}
RUN yum update -y \
&& curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo \
&& yum remove unixODBC-utf16 unixODBC-utf16-devel \
&& ACCEPT_EULA=Y yum install -y msodbcsql17 \
&& ACCEPT_EULA=Y yum install -y mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc \
&& source ~/.bashrc \
&& yum install -y unixODBC-devel \
&& yum install -y gcc-c++ \
&& yum clean all \
&& pip install --no-cache-dir --upgrade pip setuptools \
&& pip install --no-cache-dir -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
CMD [ "main.handler" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment