Hello,
I have a repository that has 2 directories inside it. These 2 directories represent 2 separate docker projects.
Now with the bitbucket pipeline, I am trying to build the images but the build fails because Docker build context is not able to locate the files required for the build.
example:
pipelines:
default:
- parallel:
- step:
script:
- docker build ${BITBUCKET_CLONE_DIR}/directory_1 --tag ${IMAGE_NAME}
# Dockerfile
# set base image (host OS)
FROM python:3.8
# set the working directory in the container
WORKDIR /code
# copy the dependencies file to the working directory
COPY requirements.txt . ----- fails at this step
# install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# copy the content of the local src directory to the working directory
COPY src/ .
# command to run on container
CMD [ "python", "./trsync.py" ]
Error:
COPY failed: stat /var/lib/docker/165536.165536/tmp/docker-builder235206778/requirements.txt: no such file or directory
I know this will work if I put the 2 docker projects in 2 different repo and keep the Dockerfile in repository root.
Thanks,
Amit
Hi @Amit Prakash Singh and welcome to the community.
I suspect the issue here may have to do with the location of the requirements.txt file and the working directory set in the Dockerfile.
In order to be able to better help you, could you please let me know:
1. I assume that you have the first Dockerfile inside directory_1?
2. What is the full path to requirements.txt file inside this repo?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.