-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathDockerfile
73 lines (61 loc) · 2.56 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
FROM python:3.10.9-alpine3.16 AS build-stage
LABEL maintainer="[email protected]"
WORKDIR /sopds
ADD https://github.com/ichbinkirgiz/sopds/archive/refs/heads/master.zip /sopds.zip
ARG FB2C_I386=https://github.com/rupor-github/fb2converter/releases/download/v1.75.1/fb2c-linux-386.zip
ARG FB2C_ARM64=https://github.com/rupor-github/fb2converter/releases/download/v1.75.1/fb2c-linux-arm64.zip
RUN apk add --no-cache -U unzip \
&& unzip /sopds.zip && rm /sopds.zip && mv sopds-*/* ./
#COPY requirements.txt .
#COPY configs/settings.py ./sopds
COPY scripts/fb2conv /fb2conv
COPY scripts/superuser.exp .
RUN apk add --no-cache -U tzdata build-base libxml2-dev libxslt-dev postgresql-dev libffi-dev libc-dev jpeg-dev zlib-dev curl \
&& cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime \
&& echo "Europe/Moscow" > /etc/timezone \
&& pip3 install --upgrade pip setuptools 'psycopg2-binary>=2.8,<2.9' \
&& pip3 install --upgrade -r requirements.txt \
&& if [ $(uname -m) = "aarch64" ]; then \
curl -L -o /fb2c_linux.zip ${FB2C_ARM64}; \
else \
curl -L -o /fb2c_linux.zip ${FB2C_I386}; \
fi \
&& unzip /fb2c_linux.zip -d /sopds/convert/fb2c/ \
&& rm /fb2c_linux.zip \
&& pip install toml-cli \
&& /sopds/convert/fb2c/fb2c export /sopds/convert/fb2c/ \
&& toml set --toml-path /sopds/convert/fb2c/configuration.toml logger.file.level none \
&& mv /fb2conv /sopds/convert/fb2c/fb2conv \
&& chmod +x /sopds/convert/fb2c/fb2conv \
&& ln -sT /sopds/convert/fb2c/fb2conv /sopds/convert/fb2c/fb2epub \
&& ln -sT /sopds/convert/fb2c/fb2conv /sopds/convert/fb2c/fb2mobi \
&& mkdir -p /sopds/tmp/ \
&& chmod ugo+w /sopds/tmp/
FROM python:3.10.9-alpine3.16 AS production-stage
LABEL maintainer="[email protected]"
ENV DB_USER="sopds" \
DB_NAME="sopds" \
DB_PASS="sopds" \
DB_HOST="" \
DB_PORT="" \
EXT_DB="False" \
TIME_ZONE="Europe/Moscow" \
SOPDS_ROOT_LIB="/library" \
SOPDS_INPX_ENABLE="True" \
SOPDS_LANGUAGE="ru-RU" \
SOPDS_SU_NAME="admin" \
SOPDS_SU_EMAIL="admin@localhost" \
SOPDS_SU_PASS="admin" \
SOPDS_TMBOT_ENABLE="False" \
MIGRATE="False" \
CONV_LOG="/sopds/opds_catalog/log" \
VERSION="0.47-devel"
COPY --from=build-stage /sopds /sopds
COPY --from=build-stage /usr/local/lib/python3.10/site-packages/ /usr/local/lib/python3.10/site-packages/
COPY scripts/start.sh /start.sh
RUN apk add --no-cache -U bash libxml2 libxslt libffi libjpeg zlib postgresql expect \
&& chmod +x /start.sh
WORKDIR /sopds
VOLUME /var/lib/pgsql
EXPOSE 8001
ENTRYPOINT ["/start.sh"]