-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.infer
More file actions
24 lines (18 loc) · 810 Bytes
/
Copy pathDockerfile.infer
File metadata and controls
24 lines (18 loc) · 810 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
# Define base image
FROM python:3.9-slim
# Define working directory in container
WORKDIR /app
# Copy requirements and install the python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the server script in the container
COPY server.py .
# Expose the container port to 8080
EXPOSE 8080
# Run the server.py script
CMD ["python", "server.py"]
# Commands to build and run the container
# 1. Build the image: sudo docker build -t model-infer:v1-python3.9-slim -f Dockerfile.infer
# 2. Check if build was successfull and find image id: sudo docker images
# 3. Run the container in detached mode and set port: sudo docker run --detach -p 5000:8080 -v ./models:/app/models model-infer:v1-python3.9-slim
# 4. Check URL to see if it worked: http://localhost:5000/