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

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

 

0 answers

Suggest an answer

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

Atlassian Community Events