Home > Back-end >  Copy folder with sub directory in Docker
Copy folder with sub directory in Docker

Time:05-25

I am trying to copy a folder with contents. But when trying to access the file from docker it shows an error

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements/development.txt'

My Dockerfile contains:

FROM python
ENV PYTHONUNBUFFERED=1
RUN apt-get update \
    && pip install pip install gunicorn
WORKDIR /usr/src/app

COPY requirements/* /usr/src/app/
RUN pip install -r requirements/development.txt
COPY . .
EXPOSE 8000
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "3", "cryb.wsgi:application"] 

CodePudding user response:

COPY requirements/* /usr/src/app/

You're copying stuff from requirements to /usr/src/app. This does NOT preserve directory structure. Make that

RUN mkdir /usr/src/app/requirements
COPY requirements/* /usr/src/app/requirements/
  • Related