php-examples-for-aws-lambda
php-examples-for-aws-lambda copied to clipboard
doc: specify what is required for dockerFile
I have a Dockerfile:
FROM public.ecr.aws/lambda/python:3.10
RUN yum install -y libffi libffi-devel postgresql-devel postgresql-libs gcc
And sls configuration:
pythonRequirements:
dockerFile: ./Dockerfile
dockerizePip: non-linux
This gives the error:
Running "docker run --rm -v /Users/shauncutts/Library/Caches/serverless-python-requirements/86c924ff078f80e03d14d56c584f87f0cbbbdb7c8193b653db2fcbfe2d8fc440_x86_64_slspyc:/var/task:z -v /Users/shauncutts/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 sls-py-reqs-custom python3.10 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache" failed with: "entrypoint requires the handler name to be the first argument"
However, when I try to put in an entrypoint into the dockerfile:
FROM public.ecr.aws/lambda/python:3.10-x86_64
RUN yum install -y libffi libffi-devel postgresql-devel postgresql-libs gcc
ENTRYPOINT [ "/bin/bash", "-c" ]
This builds, but the resulting archive doesn't have any dependencies from requirements:
unzip -l .serverless/cdh-send-sftp-cachematrix.zip
Archive: .serverless/cdh-send-sftp-cachematrix.zip
Length Date Time Name
--------- ---------- ----- ----
11788 01-01-1980 00:00 crane-provider.yml
157 01-01-1980 00:00 Dockerfile
1466 01-01-1980 00:00 handler.py
15714 01-01-1980 00:00 node_modules/.yarn-integrity
20595 01-01-1980 00:00 package-lock.json
250 01-01-1980 00:00 package.json
184 01-01-1980 00:00 Pipfile
15821 01-01-1980 00:00 Pipfile.lock
426 01-01-1980 00:00 send-config.yaml
0 01-01-1980 00:00 send/__init__.py
151 01-01-1980 00:00 send/__pycache__/__init__.cpython-36.pyc
1949 01-01-1980 00:00 send/__pycache__/check_db.cpython-36.pyc
1333 01-01-1980 00:00 send/__pycache__/download.cpython-36.pyc
221 01-01-1980 00:00 send/__pycache__/log.cpython-36.pyc
787 01-01-1980 00:00 send/__pycache__/send_config.cpython-36.pyc
2139 01-01-1980 00:00 send/__pycache__/send.cpython-36.pyc
2084 01-01-1980 00:00 send/__pycache__/to_server.cpython-36.pyc
1876 01-01-1980 00:00 send/check_db.py
896 01-01-1980 00:00 send/download.py
69 01-01-1980 00:00 send/log.py
550 01-01-1980 00:00 send/send_config.py
1901 01-01-1980 00:00 send/send.py
2299 01-01-1980 00:00 send/to_server.py
615 01-01-1980 00:00 ssh/known_hosts
30226 01-01-1980 00:00 yarn.lock
0 01-01-2098 00:00 .completed_requirements
201 01-01-2098 00:00 requirements.txt
--------- -------
113698 27 files
What are the requirements for the Dockerfile? How does serverless know where to take the libraries from and how come they don't end up in the archive?