Folder created in one step of DockerFile is not available in later steps

Issue

This Content is from Stack Overflow. Question asked by Daryl Aranha

I am trying to dockerize a flask application but before I spin up the server I need to make sure some of the files are available. These files are stored in Google Cloud Storage. A script is written that will fetch the data from GCP and store it in a folder. The final step is to run app.py but the created folder is not present during this step. Can anyone tell me what I am missing?

Here is my DockerFile

FROM python:3.8-slim-buster

WORKDIR /backend

# All python packages needed for this project are put in this file
COPY requirements.txt requirements.txt

RUN pip3 install -r requirements.txt

COPY . .

# This script currently connects to GCP cloud storage
# fetch the required file
# create a folder and store the fetched file in that folder
RUN python3 setup.py

CMD ["python3", "-m", "flask", "run", "--host=0.0.0.0"]



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?