I'm trying to write a Python AWS Lambda script. The Python code works locally in Windows, but it's using the Windows packages installed through pip. When uploading to AWS Lambda, I need to include the Linux packages.
For example, when I run pip install pandas I get:
Downloading pandas-1.0.1-cp37-cp37m-win_amd64.whl
But what I need (for uploading to AWS Lambda) is:
pandas-1.0.1-cp37-cp37m-manylinux1_x86_64.whl
My Attempt
I have tried to use Docker to simulate a Linux environment in Windows. My idea is to pip install the Linux packages in Docker and then copy them to my local machine. I think this can be done through a Docker Volume. I have tried to do this using the Dockerfile:
FROM python:3.7-slim-buster
WORKDIR /usr/src/app
# Download python packages to /usr/src/app/lib
RUN mkdir -p /usr/src/app/lib
RUN pip3 install pandas -t /usr/src/app/lib
# Copy the python pacakges to local machine
VOLUME host:/myvol
RUN mkdir /myvol
COPY /usr/src/app/lib /myvol
But when I run docker build I get the error:
COPY failed: stat /var/lib/docker/tmp/docker-builder233015161/usr/src/app/lib: no such file or directory
/usr/src/app/libexist locally? - jordanmCOPYwill run with full paths (assuming you're runningdocker build . -t some_image), since it will just look in the current build context. So even if/usr/src/app/libdid exist in your windows environment, it won't find it - C.Nivspip3 installcommand works fine. I'm trying attempting to copy out the folder inside the Docker container (/usr/src/app/lib) to the Windows folder ('host'). The 'host' directory does exist. - maureraCOPY <host_path> <container_path>is how the command works. You are looking for/usr/src/app/libon your host machine the way it's currently written - C.NivsRUN mv /usr/src/app/lib /host/. I'll check to see if that will actually work, because I'm doubtful tbh - C.Nivs