-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (45 loc) · 2.26 KB
/
Dockerfile
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# Docker file for onnxruntime-cpu
# Credit: https://hub.docker.com/_/microsoft-azureml-onnxruntimefamily
# -------------------------------------------------------------------------
FROM mcr.microsoft.com/azureml/onnxruntime:latest
# -------------------------------------------------------------------------
# End docker file for onnxruntime-cpu
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Deploy flask app
# -------------------------------------------------------------------------
LABEL MAINTAINER="Yap Jheng Khin [email protected]"
WORKDIR /app
ENV FLASK_APP=runserver.py
ENV FLASK_RUN_HOST=0.0.0.0
# Update the existing packages for security purposes
RUN apt-get update
# Install build-essentials packages, which are meta-packages that used for compiling softwares
RUN apt-get install -y --no-install-recommends --reinstall build-essential
# Install python3-dev to build Python extensions via `#include <Python.h>`
RUN apt-get install -y --no-install-recommends python3-dev
# To delete downloaded packages (.deb) already installed (and no longer needed)
RUN apt-get clean
# To remove all stored archives in your cache for packages that can not be downloaded anymore
RUN apt-get autoclean
COPY requirements.txt requirements.txt
# Upgrade pip installer for security purposes
RUN python3 -m pip install --upgrade pip
# Install necessary packages to run the API
RUN pip3 install -r requirements.txt
# Make port 80 available to the world outside this container
EXPOSE 80
COPY . .
# Tell Python that the environment is not restricted to ASCII data to resolve issues
# as mentioned here https://stackoverflow.com/questions/57652720/runtimeerror-click-will-abort-further-execution-because-python-3-was-configured
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# -------------------------------------------------------------------------
# End deploy flask app
# -------------------------------------------------------------------------
# Run runserver.py when the container launches
ENTRYPOINT [ "python3" ]
CMD [ "runserver.py" ]