My Dockerfile:
FROM amazonlinux:1
WORKDIR /
RUN yum update -y &&
yum install -y gcc openssl-devel wget tar bzip2-devel findutils
libffi-devel zlib-devel bzip2 bzip2-libs readline-devel sqlite sqlite-devel
RUN wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz &&
tar -xzvf Python-3.12.0.tgz &&
cd Python-3.12.0 &&
./configure --enable-optimizations &&
make altinstall
RUN /usr/local/bin/pip3.12 install --upgrade pip
RUN mkdir -p /packages/opencv-python-3.12/python/lib/python3.12/site-packages
COPY requirements.txt /packages/requirements.txt
RUN /usr/local/bin/pip3.12 install -r /packages/requirements.txt -t /packages/opencv-python-3.12/python/lib/python3.12/site-packages
WORKDIR /
I tried with docker build –platform=linux/amd64 -t lambda-layer-factory:latest .
And I got this error:
=> ERROR [7/9] RUN /usr/local/bin/pip3.12 install -r /packages/requirements.txt -t /packages/opencv-python-3.12/python/lib/python3.12/site-package 8.3s
------
> [7/9] RUN /usr/local/bin/pip3.12 install -r /packages/requirements.txt -t /packages/opencv-python-3.12/python/lib/python3.12/site-packages:
0.588 WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
0.600 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
...
8.161 Could not fetch URL https://pypi.org/simple/opencv-python/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/opencv-python/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
8.209 ERROR: Could not find a version that satisfies the requirement opencv-python==4.5.2.52 (from versions: none)
8.210 ERROR: No matching distribution found for opencv-python==4.5.2.52
8.222 WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
8.225 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
------
dockerfile:19
--------------------
17 | COPY requirements.txt /packages/requirements.txt
18 |
19 | >>> RUN /usr/local/bin/pip3.12 install -r /packages/requirements.txt -t /packages/opencv-python-3.12/python/lib/python3.12/site-packages
20 |
21 | WORKDIR /
--------------------
ERROR: failed to solve: process "/bin/sh -c /usr/local/bin/pip3.12 install -r /packages/requirements.txt -t /packages/opencv-python-3.12/python/lib/python3.12/site-packages" did not complete successfully: exit code: 1
My Requirements.txt:
opencv-python==4.5.2.52
numpy==1.20.2
I was trying to follow this link https://betterprogramming.pub/creating-a-python-opencv-layer-for-aws-lambda-f2d5266d3e5d