Last active
August 26, 2021 19:45
-
-
Save csotomon/e69b7c17cb72012a4debd680e550ac86 to your computer and use it in GitHub Desktop.
Python AWS lambda dockerfile for connecting to SQL Server databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM public.ecr.aws/lambda/python:3.9 | |
ADD requirements.txt . | |
ADD app.py ${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 ["app.handler"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment