I am trying to create an image of the Streamlit application (ML model). Within the application folder, I wrote a Dockerfile.txt. You can refer to the below script for reference.
# Use an official Python runtime as a parent image
FROM python:3.9-slim
RUN pip install --upgrade pip
# Set the current working directory
WORKDIR C:/Users/MainFolder/Downloads/MOE_POC_v1
# Copy the current directory contents into the container at /app
# Copy the requirements.txt file
COPY . C:/Users/MainFolder/Downloads/image/
COPY requirements.txt C:/Users/MainFolder/Downloads/image/
COPY HRDataset_v14_UAR.csv C:/Users/MainFolder/Downloads/image/
COPY HRDataset_v14.csv C:/Users/MainFolder/Downloads/image/
# dependencies can be installed and can be found in the requirements.txt file
RUN pip install --upgrade pip
RUN pip install -r C:/Users/MainFolder/Downloads/image/requirements.txt
# Make port 8500 available to the world outside this container
EXPOSE 8500
# environment variable
ENV NAME StreamlitApp
# Run Streamlit when container launches
CMD ["streamlit", "run", "C:/Users/MainFolder/Downloads/image/app.py"]
When I executed it, the image was created with no errors. When I access the application on localhost through the port, when I give the input, it states the error “No Such File or Directory”.
I observed that none of the files (datasets) were copied into the container.
Below is the file structure.
Made the changes but the issue remains same it is not transferring the files.
# Use an official Python runtime as a parent image
FROM python:3.9-slim
RUN pip install --upgrade pip
# Set the current working directory
WORKDIR /Users/MainFolder/Downloads/MOHRE_POC_v1/
# Copy the current directory contents into the container at /app
# Copy the requirements.txt file
COPY . /Users/MainFolder/Downloads/image/
COPY requirements.txt /Users/MainFolder/Downloads/image/
COPY HRDataset_v14_UAE.csv /Users/MainFolder/Downloads/image/HRDataset_v14_UAE.csv
COPY HRDataset_v14.csv /Users/MainFolder/Downloads/image/HRDataset_v14.csv
# dependencies can be installed and can be found in the requirements.txt file
RUN pip install --upgrade pip
RUN pip install -r /Users/MainFolder/Downloads/image/requirements.txt
# Make port 8501 available to the world outside this container
EXPOSE 8501
# environment variable
ENV NAME StreamlitApp
# Run Streamlit when container launches
CMD ["streamlit", "run", "/Users/MainFolder/Downloads/image/app.py"]