Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,367
Community Members
 
Community Events
176
Community Groups

Files/folders go missing when building multi-stage docker image in bitbucket pipelines

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" ]

1 answer

0 votes
Norbert C Atlassian Team Mar 04, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events