I have two dockerfiles that I use to build a docker image that's deployed as a AWS Lambda. and I would like to retain the files from docker image amazon/aws-lambda-python:3.9 in my final built docker image. I build the public docker image and publish it on docker hub.
When I build this docker image locally everything is as expected.
However, when I use Bitbucket pipelines to build my private dockerfile pulling from my public docker image, many of the essential files are missing in the final build step.
I need the entire /var folder from amazon/aws-lambda-python:3.9 as aws to be in my final docker image. How can I achieve this?
Public docker image:
FROM amazon/aws-lambda-python:3.9 as aws
ENV PATH=/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
ENV LAMBDA_RUNTIME_DIR=/var/runtime
ENV LANG=en_US.UTF-8
ENV TZ=:/etc/localtime
ENV LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
ENV LAMBDA_TASK_ROOT=/var/task
ENV LAMBDA_RUNTIME_DIR=/var/runtime
RUN yum update -y
RUN yum -y install tesseract poppler-utils
RUN python3 -m pip install --upgrade pip
RUN pip3 install pillow pytesseract requests boto3 python-dotenv pytz gql[all] PyMuPDF google-cloud-storage pdf2image --target "${LAMBDA_TASK_ROOT}"
WORKDIR ${LAMBDA_TASK_ROOT}
ENTRYPOINT [ "/lambda-entrypoint.sh" ]
Private docker image:
FROM private-docker-image:latest
ENV PATH=/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
ENV LAMBDA_RUNTIME_DIR=/var/runtime
ENV LANG=en_US.UTF-8
ENV TZ=:/etc/localtime
ENV LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
ENV LAMBDA_TASK_ROOT=/var/task
ENV LAMBDA_RUNTIME_DIR=/var/runtime
COPY --from=amazon/aws-lambda-python:3.9 / /
COPY . ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
RUN chmod -R +rwx ${LAMBDA_TASK_ROOT}
RUN chmod +x /lambda-entrypoint.sh
CMD [ "app.handler" ]
Hi @Drakenkor
Thank you for contacting Atlassian Support, I'm Norbert from Bitbucket Cloud Support, it's nice to meet with you!
Can you give me an example for the folder/file names which are missing in the /var directory? I'm going to try to build the same Dockerfile on my Pipelines, that you did locally and it succeeded.
Also can you let me know whether if you were using Bitbucket Runners or not? Once I have information I'm going to reproduce your steps.
I'm looking forward to hear from you.
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.