From 0ab6407e9b6d6d435c206c4e31f0fc813ef8380c Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 8 Sep 2020 16:27:44 +0100 Subject: [PATCH] Add Dockerfile --- .dockerignore | 17 +++++++++++++++++ Dockerfile | 19 +++++++++++++++++++ Makefile | 6 ++++++ 3 files changed, 42 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..fdc976d48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env +pip-log.txt +pip-delete-this-directory.txt +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +*.log +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f940e34fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.7-slim + +ENV MODELS_DIR /mnt/models + +RUN apt-get update && \ + apt-get -y --no-install-recommends install \ + libgomp1 + +WORKDIR /workspace +COPY setup.py . +# TODO: This busts the cache, which we don't want, but I can't see any +# way to install only deps from setup.py +COPY ./mlserver/ ./mlserver/ +RUN pip install .[all] + +COPY ./mlserver/ ./mlserver/ + +CMD mlserver start $MODELS_DIR + diff --git a/Makefile b/Makefile index 08da866fa..bc6b24d9c 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +VERSION=0.1.0 +IMAGE_NAME=seldonio/mlserver + install-dev: pip install -r requirements-dev.txt pip install --editable .[all] @@ -9,6 +12,9 @@ run: mlserver start \ ./tests/testdata +build: + docker build . -t ${IMAGE_NAME}:${VERSION} + test: tox