-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
93 lines (68 loc) · 2.78 KB
/
Dockerfile
File metadata and controls
93 lines (68 loc) · 2.78 KB
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
FROM python:3
#####################
LABEL author="RJS <r.j.smith@ljmu.ac.uk>"
LABEL description="Environmentin which to run vgg16 classifier for wild M1 spasms detection"
# Update base OS
RUN apt -y update
RUN apt -y upgrade
# "--root-user-action ignore" suppresses warning that says not to run pip as root
RUN pip install --root-user-action ignore --upgrade pip
# Add temporary download space
#ENV DDIR=$WORKDIR/downloads
#RUN mkdir -p $DDIR
# Add the working directory
ENV WORKDIR=/app
#ADD . $WORKDIR # Do not do this so early? Messes up cacheing?
WORKDIR $WORKDIR
# Where compose will mount the external persistent storage
RUN mkdir /mnt/external
# Install everything from requirements.txt
#COPY requirements.txt $WORKDIR
#RUN pip install --root-user-action ignore -r $WORKDIR/requirements.txt
# I prefer to pip them one at a time because when they are all wrapped in requirements.txt, Docker cannot cache images effectively
#os
#sys
#argparse
#socket
#timeit
# Maybe do not need <2. That was required for pylibtiff which I no longer use. Try newer numpy
RUN pip install --root-user-action ignore "numpy<2.0"
RUN pip install --root-user-action ignore astropy
RUN pip install --root-user-action ignore torch
RUN pip install --root-user-action ignore torchvision
RUN pip install --root-user-action ignore pillow
COPY app_ml_server.py $WORKDIR
# Install build tools
#RUN yum install -y gcc gcc-c++ kernel-devel wget git curl make tcsh \
# && yum install -y python-devel libxslt-devel libffi-devel openssl-devel
# pillow needs zlib libjpeg python
#RUN yum -y install zlib zlib-devel libjpeg libjpeg-devel python-devel python3-devel
# Install Python package manager pip
#RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "$DDIR/get-pip.py" \
# && python $DDIR/get-pip.py
# Install Python packages
# backports.functools-lru-cache is necessary to solve the "missing site-package/six" problem
#
# Had a lot of trouble installing torch. I think the VM ran out of memory. Symptom was
# pip ended with messge "killed" and nothing more, no diagnostics or error message.
# Adding --no-cache-dir may help?
# VM just needs more RAM?
#
#RUN pip install backports.functools-lru-cache \
#RUN pip3 install --no-cache-dir astropy
# && pip3 install --no-cache-dir argparse
# && pip3 install --no-cache-dir future
# && pip3 install --no-cache-dir torch
# && pip3 install --no-cache-dir pillow
# && pip3 install --no-cache-dir torchvision
# install dnf
#RUN yum install -y epel-release
#RUN yum install -y dnf
# Remove the epel-release after sorting out dnf
#RUN yum remove -y epel-release
# Add non-root user "data" inside the container
#RUN dnf install -y sudo \
# && groupadd -g 600 web \
# && adduser -u 501 -g 600 data \
# && echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user \
# && chmod 0440 /etc/sudoers.d/user