[b4c0b6]: / 11-Docker / Dockerfile

Download this file

28 lines (19 with data), 663 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Use an official Python runtime as the base image
FROM --platform=linux/amd64 python:3.10.13
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy the requirements file to the working directory
COPY requirements.txt .
# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the FastAPI application code to the working directory
COPY model.pkl ./
COPY docker_api.py ./
COPY requirements.txt ./
COPY train.csv ./
COPY model2.pkl ./
# Expose port 80 for the FastAPI application
EXPOSE 80
ENV PORT=80
# Run the FastAPI application using Uvicorn when the container starts
CMD ["python", "docker_api.py"]