-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
executable file
·150 lines (143 loc) · 3.94 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# syntax=docker/dockerfile:1
FROM ghcr.io/imagegenius/baseimage-immich:latest
# set version label
ARG BUILD_DATE
ARG VERSION
ARG IMMICH_VERSION
LABEL build_version="ImageGenius Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="hydazz, martabal"
# environment settings
ENV \
IMMICH_BUILD_DATA="/app/immich/server" \
IMMICH_ENV="production" \
IMMICH_MACHINE_LEARNING_URL="http://127.0.0.1:3003" \
IMMICH_MEDIA_LOCATION="/photos" \
IMMICH_PORT="8080" \
MACHINE_LEARNING_CACHE_FOLDER="/config/machine-learning/models" \
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
TRANSFORMERS_CACHE="/config/machine-learning/models"
RUN \
echo "**** install build packages ****" && \
apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
python3-dev \
python3-pip \
python3-venv && \
echo "**** install runtime packages ****" && \
apt-get install --no-install-recommends -y \
python3 && \
echo "**** download immich ****" && \
mkdir -p \
/tmp/immich && \
if [ -z ${IMMICH_VERSION} ]; then \
IMMICH_VERSION=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | \
jq -r '.tag_name'); \
fi && \
curl -o \
/tmp/immich.tar.gz -L \
"https://github.com/immich-app/immich/archive/${IMMICH_VERSION}.tar.gz" && \
tar xf \
/tmp/immich.tar.gz -C \
/tmp/immich --strip-components=1 && \
echo "**** build server ****" && \
mkdir -p \
/tmp/node_modules && \
cd /tmp/immich/server && \
npm ci && \
rm -rf node_modules/@img/sharp-libvips* && \
rm -rf node_modules/@img/sharp-linuxmusl-x64 && \
cp -r \
node_modules/@img \
node_modules/exiftool-vendored.pl \
/tmp/node_modules && \
npm run build && \
npm prune --omit=dev --omit=optional && \
cp -r \
/tmp/node_modules/@img \
/tmp/node_modules/exiftool-vendored.pl \
node_modules && \
npm link && \
npm cache clean --force && \
cp -a \
resources \
package.json \
package-lock.json \
node_modules \
dist \
/app/immich/server && \
echo "**** copy scripts ****" && \
cd /tmp/immich/docker && \
cp -r \
scripts \
/app/immich/server && \
echo "**** build open-api ****" && \
cd /tmp/immich/open-api/typescript-sdk && \
npm ci && \
npm run build && \
echo "**** build web ****" && \
mkdir -p \
/app/immich/server/www && \
cd /tmp/immich/web && \
npm ci && \
npm run build && \
cp -a \
build/* \
static \
/app/immich/server/www && \
echo "**** build CLI ****" && \
mkdir -p \
/app/immich/cli && \
cd /tmp/immich/cli && \
npm ci && \
npm run build && \
npm prune --omit=dev --omit=optional && \
cp -a \
package.json \
package-lock.json \
node_modules \
dist \
/app/immich/cli && \
echo "**** build machine-learning ****" && \
mkdir -p \
/app/immich/machine-learning/ann && \
cd /tmp/immich/machine-learning && \
pip install --break-system-packages -U --no-cache-dir \
poetry && \
python3 -m venv /lsiopy && \
poetry config installer.max-workers 10 && \
poetry config virtualenvs.create false && \
poetry install --sync --no-interaction --no-ansi --no-root --with cpu --without dev && \
cp -a \
pyproject.toml \
poetry.lock \
app \
log_conf.json \
/app/immich/machine-learning && \
cp -a \
ann/ann.py \
/app/immich/machine-learning/ann && \
echo "**** cleanup ****" && \
for cleanfiles in *.pyc *.pyo; do \
find /usr/local/lib/python3.* /usr/lib/python3.* /lsiopy/lib/python3.* -name "${cleanfiles}" -delete; \
done && \
apt-get remove -y --purge \
build-essential \
python3-dev \
python3-pip \
python3-venv && \
apt-get autoremove -y --purge && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/tmp/* \
/var/lib/apt/lists/* \
/root/.cache \
/root/.npm
# copy local files
COPY root/ /
# environment settings
ENV NODE_ENV="production"
# ports and volumes
EXPOSE 8080
VOLUME /config /libraries