-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
103 lines (77 loc) · 3.05 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# LabCAS ML Serve
# ===============
#
# Build with: `docker image build --tag labcas-ml-serve .`
# Base Image
# ----------
#
# Normally I'd use an Alpine image here, but Ray won't install on Alpine; see this issue for
# the sordid details: https://github.com/ray-project/ray/issues/30416
#
# In the future, if we need to support multiple Python versions, simply do
#
# docker image build --build-arg python_version=PYTHON_VERSION --tag labcas-ml-serve:VERSION-PYTHON_VERSION
#
# and replace PYTHON_VERSION with the version of Python you like, such as 3.10.5, and VERSION
# with the version of LabCAS ML Serve being built. Repeat for each Python version needed. No
# need for pyenv.
ARG python_version=3.9.15
FROM python:${python_version}-bullseye
# Application
# -----------
#
# Copy over and install the Python-based requirements
WORKDIR /usr/src/app
COPY configs/environments/environment_B/requirements.txt requirements.txt
RUN pip install --requirement requirements.txt
COPY ./ ./
# Image Morphology
# ----------------
#
# Ports, entrypoint, etc.
EXPOSE 8080/tcp
EXPOSE 6378/tcp
EXPOSE 8265/tcp
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
# HEALTHCHECK ???
# Metadata
# --------
#
# We're "good Docker citizens"
LABEL "org.label-schema.name"="LabCAS ML Serve"
LABEL "org.label-schema.description"="LabCAS Nuclei Detector featuring machine learning and powered by Ray Serve"
LABEL "org.label-schema.version"="0.0.0"
# Posterity
# ---------
#
# Everything below this line are comments from an earlier version of this `Dockerfile` preserved
# for future generations.
## ==== run commands:
# docker build -t labcas-ml-serve:1
# docker run -p 6378:6378 -p 8080:8080 -p 8265:8265 -v $PWD:/usr/src/app --shm-size=1gb -it labcas-ml-serve:1 bash
# ==== some useful docker commands:
# to look for stopped containers:
# >> docker ps -a
# to start a stopped container:
# >> docker start <Container_ID>
# to detach:
# >> ctrl+p+q
# to attach:
# >> docker attach <Container_ID>
# remove all containers:
# >> docker rm $(docker ps -a -q)
# ==== commands for setting things up manually in linux:
## install penv and python versions. Ref: https://www.liquidweb.com/kb/how-to-install-pyenv-on-ubuntu-18-04/
# apt update -y
# DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
# git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
# echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
# exec "$SHELL"
# pyenv install 3.7.8
## install and create pyenv virtualenv. Ref: https://www.liquidweb.com/kb/how-to-install-pyenv-virtualenv-on-ubuntu-18-04/
# git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
# echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
# pyenv virtualenv 3.7.8 environment_A
# RUN exec "$SHELL"