-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
168 lines (148 loc) · 7.68 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
FROM python:3.11.11-alpine3.20 AS pgagent-builder
ARG PGAGENT_TAG
ENV PATH="/usr/libexec/postgresql16:$PATH"
RUN apk add --update --no-cache \
cmake boost-dev build-base linux-headers postgresql16-dev curl unzip jq && \
find /usr -name pg_config && \
/usr/bin/pg_config --version && \
/usr/bin/pg_config --includedir && \
/usr/bin/pg_config --libdir && \
/usr/bin/pg_config --sharedir && \
curl -L https://github.com/pgadmin-org/pgagent/archive/refs/tags/${PGAGENT_TAG}.zip -o pgagent-latest.zip && \
unzip pgagent-latest.zip && \
mv pgagent-*/ pgagent && \
cd pgagent && mkdir build && cd build && rm -rf CMakeCache.txt &&\
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
make && make install && \
mkdir -p /usr/share/postgresql16/extension && \
cp ../sql/pgagent*.sql /usr/share/postgresql16/extension/ && \
cp ../pgagent.control.in /usr/share/postgresql16/extension/pgagent.control && \
PGAGENT_VERSION=$(ls /usr/share/postgresql16/extension/pgagent--*.sql | sed -E 's/.*pgagent--([0-9]+\.[0-9]+).*/\1/' | sort -V | tail -n 1) && \
sed -i "s/\${MAJOR_VERSION}.\${MINOR_VERSION}/$PGAGENT_VERSION/" /usr/share/postgresql16/extension/pgagent.control && \
mkdir /pgadmin && cd /pgadmin && python3 -m venv /pgadmin/venv && \
source /pgadmin/venv/bin/activate && \
pip install pip==24.0 setuptools==66.0.0 && \
pip install pgadmin4 && \
cd ../.. && rm -rf pgagent pgagent-latest.zip
FROM alpine:3.20 AS systemstats-builder
ARG SYS_STATS_TAG
ENV PATH="/usr/lib/postgresql16/bin:$PATH"
RUN rm -rf /var/cache/apk/* && apk update && \
apk add --no-cache build-base postgresql16-dev curl unzip jq && \
find /usr -name pg_config && \
/usr/bin/pg_config --version && \
/usr/bin/pg_config --includedir && \
/usr/bin/pg_config --libdir && \
/usr/bin/pg_config --sharedir && \
curl -L https://github.com/EnterpriseDB/system_stats/archive/refs/tags/${SYS_STATS_TAG}.zip -o system_stats-latest.zip && \
unzip system_stats-latest.zip && \
mv system_stats-*/ system_stats && \
cd system_stats && export PATH="/usr/bin:$PATH" && \
make USE_PGXS=1 && make install USE_PGXS=1 && \
mkdir -p /usr/share/postgresql16/extension && \
cp system_stats.control /usr/share/postgresql16/extension/ && \
cp system_stats--*.sql /usr/share/postgresql16/extension/ && \
cd .. && rm -rf system_stats system_stats-latest.zip
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS zilean-builder
ARG TARGETARCH
ARG ZILEAN_TAG
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v3.18/main" > /etc/apk/repositories && \
echo "https://dl-cdn.alpinelinux.org/alpine/v3.18/community" >> /etc/apk/repositories && \
apk add --update --no-cache curl jq python3=~3.11 py3-pip=~23.1 && \
curl -L https://github.com/iPromKnight/zilean/archive/refs/tags/${ZILEAN_TAG}.zip -o zilean-latest.zip && \
unzip zilean-latest.zip && \
mv zilean-*/ /zilean && \
echo $ZILEAN_TAG > /zilean/version.txt && \
cd /zilean && \
dotnet restore -a $TARGETARCH && \
cd /zilean/src/Zilean.ApiService && \
dotnet publish -c Release --no-restore -a $TARGETARCH -o /zilean/app/ && \
cd /zilean/src/Zilean.Scraper && \
dotnet publish -c Release --no-restore -a $TARGETARCH -o /zilean/app/ && \
cd /zilean && \
python3 -m venv /zilean/venv && \
source /zilean/venv/bin/activate && \
pip install -r /zilean/requirements.txt
FROM python:3.11.11-alpine3.20 AS riven-frontend-builder
ARG RIVEN_FRONTEND_TAG
RUN apk add --no-cache curl npm && \
curl -L https://github.com/rivenmedia/riven-frontend/archive/refs/tags/${RIVEN_FRONTEND_TAG}.zip -o riven-frontend.zip && \
unzip riven-frontend.zip && \
mkdir -p /riven/frontend && \
mv riven-frontend-*/* /riven/frontend && rm riven-frontend.zip && \
cd /riven/frontend && \
sed -i '/export default defineConfig({/a\ build: {\n minify: false\n },' /riven/frontend/vite.config.ts && \
sed -i "s#/riven/version.txt#/riven/frontend/version.txt#g" /riven/frontend/src/routes/settings/about/+page.server.ts && \
sed -i "s/export const prerender = true;/export const prerender = false;/g" /riven/frontend/src/routes/settings/about/+page.server.ts && \
npm install -g pnpm && \
pnpm install && \
pnpm run build && \
pnpm prune --prod
FROM python:3.11.11-alpine3.20 AS riven-backend-builder
ARG RIVEN_TAG
RUN apk add --no-cache curl gcc musl-dev python3-dev gcompat libstdc++ libxml2-utils linux-headers && \
curl -L https://github.com/rivenmedia/riven/archive/refs/tags/${RIVEN_TAG}.zip -o riven.zip && \
unzip riven.zip && \
mkdir -p /riven/backend && \
mv riven-*/* /riven/backend && rm riven.zip && \
cd /riven/backend && \
python3 -m venv /riven/backend/venv && \
source /riven/backend/venv/bin/activate && \
pip install --upgrade pip && \
pip install poetry && \
poetry config virtualenvs.create false && \
poetry install --no-root --without dev
FROM python:3.11.11-alpine3.20 AS requirements-builder
COPY requirements.txt .
RUN apk add --no-cache curl gcc musl-dev python3-dev gcompat libstdc++ libxml2-utils linux-headers && \
python3 -m venv /venv && \
source /venv/bin/activate && \
pip install --upgrade pip && \
pip install -r requirements.txt
FROM python:3.11.11-alpine3.20 AS final-stage
ARG TARGETARCH
LABEL name="DMB" \
description="Debrid Media Bridge" \
url="https://github.com/I-am-PUID-0/DMB"
RUN apk add --update --no-cache gcompat libstdc++ libxml2-utils curl tzdata nano ca-certificates wget fuse3 build-base \
linux-headers py3-cffi libffi-dev rust cargo jq openssl pkgconfig npm boost-filesystem boost-thread \
ffmpeg postgresql16-client=16.6-r0 postgresql16=16.6-r0 postgresql16-contrib=16.6-r0 && \
find /usr -name pg_config && \
/usr/bin/pg_config --version && \
/usr/bin/pg_config --includedir && \
/usr/bin/pg_config --libdir && \
/usr/bin/pg_config --sharedir
RUN npm install -g pnpm
RUN ARCH=$(case "$TARGETARCH" in \
"amd64") echo "x64" ;; \
"arm64") echo "arm64" ;; \
*) echo "$TARGETARCH" ;; \
esac) && \
curl -L --retry 5 --retry-delay 5 https://dotnetcli.azureedge.net/dotnet/Sdk/9.0.100/dotnet-sdk-9.0.100-linux-musl-${ARCH}.tar.gz -o dotnet-sdk.tar.gz && \
ls -lh dotnet-sdk.tar.gz && \
file dotnet-sdk.tar.gz && \
mkdir -p /usr/share/dotnet && \
tar -C /usr/share/dotnet -xzf dotnet-sdk.tar.gz && \
ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet && \
rm dotnet-sdk.tar.gz && \
dotnet --version
WORKDIR /
COPY --from=rclone/rclone:latest /usr/local/bin/rclone /usr/local/bin/rclone
COPY --from=pgagent-builder /usr/local/bin/pgagent /usr/local/bin/pgagent
COPY --from=pgagent-builder /usr/share/postgresql16/extension/pgagent* /usr/share/postgresql16/extension/
COPY --from=pgagent-builder /pgadmin/venv /pgadmin/venv
COPY --from=systemstats-builder /usr/share/postgresql16/extension/system_stats* /usr/share/postgresql16/extension/
COPY --from=systemstats-builder /usr/lib/postgresql16/system_stats.so /usr/lib/postgresql16/
COPY --from=zilean-builder /zilean /zilean
COPY --from=riven-frontend-builder /riven/frontend /riven/frontend
COPY --from=riven-backend-builder /riven/backend /riven/backend
ADD https://raw.githubusercontent.com/debridmediamanager/zurg-testing/main/config.yml /zurg/
ADD https://raw.githubusercontent.com/debridmediamanager/zurg-testing/main/scripts/plex_update.sh /zurg/
COPY --from=requirements-builder /venv /venv
COPY . /./
ENV \
XDG_CONFIG_HOME=/config \
TERM=xterm
HEALTHCHECK --interval=60s --timeout=10s \
CMD ["/bin/sh", "-c", "source /venv/bin/activate && python /healthcheck.py"]
ENTRYPOINT ["/bin/sh", "-c", "source /venv/bin/activate && python /main.py"]