I am at my first hands on practice with trying to deploy my model on GCloud and I am using podman. When I try to build the container with podman build -t default-service-fastpai:latest . , I get an error at STEP 6/9
STEP 6/8: COPY app /
Error: building at STEP "COPY app /": checking on sources under "Documents/Projects/Pred_default/app": copier: stat: "/app": no such file or directory
The folder is formatted as follows:
└── Pred_default
└── app
└── Containerfile
└── app.py
└── app_test.py
└── lgb_credit_model.pkl
└── lgb_es_model.pkl
└── measure_response.py
└── requirements.txt
└── .gitignore
└── LICENSE.md
└── README.md
└── credit_predict.ipynb
└── requirements.txt
And this is the Containerfile. I am not sure what is going wrong, the app.py is right there, why can't podman see it?
FROM python:3.10-slim
RUN mkdir /app
# Set the working directory
WORKDIR /app
# Copy the requirements file into the container
COPY requirements.txt requirements.txt
# Install the required packages
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Copy the application code into the container
COPY app /
# COPY ["lgb_credit_model.pkl", "lgb_es_model.pkl" "app.py", "./"]
# Expose the app port
EXPOSE 80
# Run command
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
From the error you shared and your Containerfile, it seems the issue is due to the fact that the
COPYcommand in your Containerfile cannot find theappdirectory within the specified context. It tries to copy theappdirectory to the root directory (/) of the container, but it seems like you might want to copy it into the/appdirectory you created inside the container.Change the
COPYcommand in your Containerfile from:to:
This should correctly copy the contents of your local
appdirectory into the/appdirectory inside the container.Also make sure to run the
podman buildcommand from thePred_defaultdirectory, where theappdirectory is located.