From 1b1adb08698be6c74a5209079a353f835b071009 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 6 Sep 2024 18:27:34 +1000 Subject: [PATCH] Slight changes for dockerised version --- Dockerfile | 27 +++++++++++++++++++++++++++ minvime-runner.py | 1 + minvime/templates/index.html | 3 ++- requirements.txt | 2 ++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f80b379 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM python:3-alpine AS builder + +WORKDIR /app + +RUN python3 -m venv venv +ENV VIRTUAL_ENV=/app/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Stage 2 +FROM python:3-alpine AS runner + +WORKDIR /app + +COPY --from=builder /app/venv venv +COPY minvime minvime +COPY minvime-runner.py app.py + +ENV VIRTUAL_ENV=/app/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +ENV FLASK_APP=app/app.py + +EXPOSE 8080 + +CMD ["gunicorn", "--bind" , ":8080", "--workers", "2", "app:app"] diff --git a/minvime-runner.py b/minvime-runner.py index 5c24940..a78df8b 100755 --- a/minvime-runner.py +++ b/minvime-runner.py @@ -4,6 +4,7 @@ """Convenience wrapper for running minvime directly from source tree.""" from minvime.minvime import main +from minvime.minvime import app if __name__ == '__main__': main() diff --git a/minvime/templates/index.html b/minvime/templates/index.html index 8a9bf80..9348ab7 100755 --- a/minvime/templates/index.html +++ b/minvime/templates/index.html @@ -67,7 +67,8 @@ These methods need to make some very strong assumptions about the way your model will be deployed and used. Please read through the notes on each method and feel free to contribute ideas to the development of this tool. - @john_c_hawkins + + @john_c_hawkins diff --git a/requirements.txt b/requirements.txt index f869702..f09d75b 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +gunicorn +setuptools Flask>=2.2.2 numpy>=1.16.4 pandas>=0.25.3