-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
111 lines (103 loc) · 3.38 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
104
105
106
107
108
109
110
111
# syntax=docker/dockerfile:1
FROM ghcr.io/imagegenius/obico-darknet:latest as darknet
# runtime
FROM ghcr.io/imagegenius/baseimage-ubuntu:noble
# set version label
ARG BUILD_DATE
ARG VERSION
ARG OBICO_VERSION
LABEL build_version="ImageGenius Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="hydazz"
# environment settings
ENV DEBIAN_FRONTEND="noninteractive" \
DATABASE_URL="sqlite:////config/db.sqlite3" \
INTERNAL_MEDIA_HOST="http://localhost:3334" \
ML_API_HOST="http://localhost:3333" \
MOONRAKER_COMMIT="f735c0419444848b59342a98ad3532eef123ea46"
RUN \
echo "**** add python3.10 to apt ****" && \
echo "deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble main" >>/etc/apt/sources.list.d/python.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys f23c5a6cf475977595c89f51ba6932366a755776 && \
echo "**** install runtime packages ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ffmpeg \
gcc \
git \
libfontconfig1 \
libpq-dev \
libsm6 \
postgresql \
libxrender1 \
python3.10 \
python3.10-dev \
python3.10-distutils && \
curl -s https://bootstrap.pypa.io/get-pip.py | python3.10 && \
pip3 install --upgrade \
packaging \
pip \
setuptools \
wheel && \
echo "**** install obico ****" && \
if [ -z ${OBICO_VERSION+x} ]; then \
OBICO_VERSION=$(curl -sL "https://api.github.com/repos/TheSpaghettiDetective/obico-server/commits?ref=release" | jq -r '.[0].sha' | cut -c1-8); \
fi && \
git clone -b release https://github.com/TheSpaghettiDetective/obico-server.git /tmp/obico-server && \
git -C /tmp/obico-server checkout ${OBICO_VERSION} && \
pip3 install \
onnxruntime-gpu \
pipenv==2022.12.19 \
importlib_metadata==8.2.0 \
opencv_python_headless && \
pip3 install -r /tmp/obico-server/ml_api/requirements.txt && \
pip3 install -r /tmp/obico-server/backend/requirements.txt && \
echo "**** install moonraker ****" && \
git clone https://github.com/Arksine/moonraker.git /app/moonraker && \
git -C /app/moonraker checkout ${MOONRAKER_COMMIT} && \
echo "**** move files into place ****" && \
mkdir -p /app/obico && \
mv /tmp/obico-server/backend \
/app/obico/backend && \
mv /tmp/obico-server/ml_api \
/app/obico/ml_api && \
mv /tmp/obico-server/frontend \
/app/obico/frontend && \
echo "**** configure obico ****" && \
for weight in onnx darknet; do \
curl -o \
/app/obico/ml_api/model/model-weights.${weight} -L \
$(cat /app/obico/ml_api/model/model-weights.${weight}.url | tr -d '\r'); \
done && \
mkdir -p \
/app/model \
/app/obico/backend/static_build/ && \
mv /app/obico/ml_api/model/names /app/model/ && \
ln -s \
/config/media \
/app/obico/backend/static_build/media && \
echo "**** cleanup ****" && \
for cleanfiles in *.pyc *.pyo; do \
find /usr/local/lib/python3.* /usr/lib/python3.* -name "${cleanfiles}" -delete; \
done && \
apt-get remove -y --purge \
curl \
gcc \
libpq-dev \
python3.10-dev && \
apt-get autoremove -y --purge && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
/root/.cache
# environment settings
ENV PYTHONPATH="/app/moonraker/"
# copy local files
COPY root/ /
# add darknet libraries
COPY --from=darknet /darknet-cpu /darknet
# ports and volumes
EXPOSE 3334
VOLUME /config