Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files1234567891011121314151617181920212223# Use an official lightweight Python runtime as a parent imageFROM python:3.9-slim# Set the working directory inside the containerWORKDIR /app# Copy the file that lists the dependencies to the working directoryCOPY requirements.txt .# Install the dependencies from requirements.txt# --no-cache-dir ensures the image is smallerRUN pip install --no-cache-dir -r requirements.txt# Copy all the other files from your local project folder (app.py, model.pkl)# into the container's working directoryCOPY . .# Inform Docker that the container listens on port 8080 at runtimeEXPOSE 8080# Define the command to run your application# This will execute "python app.py" when the container startsCMD ["python", "app.py"]1234567891011121314151617181920212223242526# Use an official Python runtime as a parent image# Using a slim version to keep the image size smallerFROM python:3.9-slim# Set the working directory in the containerWORKDIR /app# Copy the requirements file into the container at /app# This is done first to leverage Docker's layer cachingCOPY requirements.txt .# Install any needed packages specified in requirements.txt# Using --no-cache-dir to reduce image size# Specifying a CPU-only version of PyTorch to significantly reduce image sizeRUN pip install --no-cache-dir -r requirements.txt --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 containerEXPOSE 8080# Define the command to run your app# This command runs when the container launchesCMD ["python", "app.py"]
Dockerfile+15-12