Docker Community Forums

Share and learn in the Docker community.

Zip files (for AWS Lambda), but exclude certain folders

The following is my Dockerfile :

FROM lambci/lambda:build-python3.7

RUN python3 -m venv venv
RUN . venv/bin/activate

RUN pip install pystan==2.18
RUN pip install fbprophet

# Create zip
RUN pushd /var/task/venv/lib/python3.7/site-packages/
# Exclude folders in .lambdaignore
RUN zip -r -9 -q /var/task/ *
RUN popd
RUN zip -9r

You can see one comment where I wrote:

Exclude folders in .lambdaignore

That’s the point where I am stuck. Before building the .zip file. I want to exclude the following two folders:


Ideally, I just add a .lambdaignore file and each line is just excluded from the .zip That way it would be more flexible. Can you help me with that?