Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Files Disappearing During Multi-Stage Docker Build (Bitbucket Pipeline)

Fabián Matías Vega Alcota
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 3, 2024

I'm trying to build a base image for the pipeline with pre-installed dependencies. I'm using a multistage build approach in a Dockerfile like this:

base.dockerfile

FROM python:$PYTHON_BASE AS base

RUN deps="" \
&& apt update \
&& apt-get install -y --no-install-recommends $deps

FROM base AS building-python-dependencies

WORKDIR /app

RUN <<EOF
set -ex
pip install -U pdm \
&& pdm install --frozen-lockfile --no-editable # This create the .venv (Confirmed)
EOF

FROM base as final

COPY --from=building-python-dependencies /app/.venv /app/.venv # This step fail

ENV PATH=/app/.venv/bin:$PATH \
PYTHONPATH=/app/.venv/lib/python3.11/site-packages

I encounter the following error during the build process:

Step 16/19 : COPY --from=building-python-dependencies /app/.venv /app/.venv
Service 'base' failed to build: COPY failed: stat app/.venv: file does not exist

 

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 4, 2024

Hi Fabián,

I'd suggest testing this locally in a Docker container to see if you receive the same error - and adjusting the path if necessary, typically this error would indicate an issue with the path used when copying.

If you still require further assistance - we'd need to take a closer look at your build environment. To do so - our system requires a support ticket. As you are a Premium customer - you are entitled to formal support from our support team, you may raise a ticket below:

If you have issues raising a ticket - please let me know your timezone so I can raise one on your behalf with the appropriate team.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events