# Use an official Python runtime as a parent image # Using a slim version to keep the image size smaller FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Copy the requirements file into the container at /app # This is done first to leverage Docker's layer caching COPY requirements.txt . # Install any needed packages specified in requirements.txt # Using --no-cache-dir to reduce image size # Installs packages from the standard PyPI and also looks in the PyTorch index for torch RUN pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu # Copy the rest of your application's code into the container # This includes app.py, your trained model (.pth), and the scaler (.pkl) COPY . . # Make port 8080 available to the world outside this container EXPOSE 8080 # Define the command to run your app # This command runs when the container launches CMD ["python", "app.py"]