-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
105 lines (83 loc) · 3.73 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
FROM python:3.12-slim
ARG BUILD_TYPE
# Visionatrix enviroment variables
ENV VIX_HOST="127.0.0.1"
ENV VIX_PORT=8288
ENV USER_BACKENDS="vix_db;nextcloud"
ENV MODELS_DIR="/nc_app_visionatrix_data/vix_models"
ENV TASKS_FILES_DIR="/nc_app_visionatrix_data/vix_tasks_files"
ENV VIX_SERVER_FULL_MODELS="1"
RUN apt-get update && apt-get install -y git \
python3-dev python3-setuptools netcat-traditional \
libxml2-dev libxslt1-dev zlib1g-dev g++ \
ffmpeg libsm6 libxext6 lsb-release sudo wget procps nano xmlstarlet && \
apt-get autoclean
ADD ex_app_scripts/common_pgsql.sh /ex_app_scripts/
RUN chmod +x /ex_app_scripts/common_pgsql.sh
ADD ex_app_scripts/install_pgsql.sh /ex_app_scripts/
RUN chmod +x /ex_app_scripts/install_pgsql.sh && /ex_app_scripts/install_pgsql.sh && rm /ex_app_scripts/install_pgsql.sh
COPY appinfo/info.xml /info.xml
RUN VISIONATRIX_VERSION=$(xmlstarlet sel -t -v "//image-tag" /info.xml) && \
git clone https://github.com/Visionatrix/Visionatrix.git /Visionatrix && \
cd /Visionatrix && \
git checkout tags/v$VISIONATRIX_VERSION && \
rm /info.xml
RUN cd /Visionatrix && python3 -m venv venv && venv/bin/python -m pip install -U pip && rm -rf ~/.cache/pip
RUN cd /Visionatrix && \
ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then \
echo "Installing PyTorch for ARM64"; \
venv/bin/python -m pip install torch==2.4.1 torchvision torchaudio; \
elif [ "$BUILD_TYPE" = "rocm" ]; then \
venv/bin/python -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \
elif [ "$BUILD_TYPE" = "cpu" ]; then \
venv/bin/python -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \
else \
venv/bin/python -m pip install torch==2.4.1 torchvision torchaudio; \
fi && \
rm -rf ~/.cache/pip
RUN cd /Visionatrix && \
venv/bin/python -m pip install "psycopg[binary]" greenlet && \
venv/bin/python -m pip install . && \
rm -rf ~/.cache/pip
RUN cd /Visionatrix && \
venv/bin/python -m visionatrix install && \
AUTO_INIT_CONFIG_MODELS_DIR=$MODELS_DIR venv/bin/python scripts/easy_install.py && \
rm visionatrix.db && \
rm -rf ~/.cache/pip
# Setup nodejs and npm for building the front-end client
RUN apt-get update && \
apt-get install -y curl gnupg2 build-essential supervisor && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install dependncies, build the client and remove node_modules
RUN cd /Visionatrix && \
rm -rf visionatrix/client && \
cd web && \
npm ci && \
NUXT_APP_BASE_URL="/index.php/apps/app_api/proxy/visionatrix/" npm run build && \
cp -r .output/public ../visionatrix/client && \
rm -rf node_modules
# Remove nodejs and npm and clean cache
RUN apt-get remove -y nodejs npm && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf ~/.cache
# Setup ExApp dependencies
COPY ex_app_scripts/init_pgsql.sh /ex_app_scripts/init_pgsql.sh
COPY ex_app_scripts/entrypoint.sh /ex_app_scripts/entrypoint.sh
COPY ex_app_scripts/run_visionatrix.sh /ex_app_scripts/run_visionatrix.sh
RUN chmod +x /ex_app_scripts/*.sh
COPY requirements.txt /
RUN python3 -m pip install -r /requirements.txt && rm -rf ~/.cache && rm /requirements.txt
ADD /ex_app/cs[s] /ex_app/css
ADD /ex_app/im[g] /ex_app/img
ADD /ex_app/j[s] /ex_app/js
ADD /ex_app/l10[n] /ex_app/l10n
ADD /ex_app/li[b] /ex_app/lib
COPY --chmod=775 healthcheck.sh /
WORKDIR /Visionatrix
CMD ["/bin/sh", \
"/ex_app_scripts/entrypoint.sh", \
"/ex_app/lib/main.py", \
"/ex_app_scripts/run_visionatrix.sh"]
HEALTHCHECK --interval=2s --timeout=2s --retries=300 CMD /healthcheck.sh