Deploying ML models using Docker
To create a Docker container with our newly created web service (or two of them), we need to install Docker on our system. Once we’ve installed Docker, we can use it to compile the container.
The crucial part of packaging the web service into the Docker container is the Dockerfile. It is a recipe for how to assemble the container and how to start it. If you’re interested, I’ve suggested a good book about Docker containers in the Further reading section so that you can learn more about how to create more advanced components than the ones in this book.
In our example, we need two containers. The first one will be the container for the measurement instrument. The code for that container is as follows:
FROM alpine:latest RUN apk update RUN apk add py-pip RUN apk add --no-cache python3-dev RUN pip install --upgrade pip WORKDIR /app COPY . /app RUN pip --no-cache-dir install -r requirements.txt CMD ["python3", "...