fgg55778 commited on
Commit
cf4a849
·
verified ·
1 Parent(s): 4d28935

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +144 -0
Dockerfile ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-slim as nodebuilder
2
+
3
+ FROM python:3.11-slim-bullseye as builder
4
+ ARG QL_MAINTAINER="whyour"
5
+ LABEL maintainer="${QL_MAINTAINER}"
6
+ ARG QL_URL=https://github.com/${QL_MAINTAINER}/qinglong.git
7
+ ARG QL_BRANCH=debian
8
+
9
+ ENV QL_DIR=/ql \
10
+ QL_BRANCH=${QL_BRANCH}
11
+
12
+ COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
13
+ COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
14
+ RUN set -x && \
15
+ ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
16
+ apt-get update && \
17
+ apt-get install --no-install-recommends -y libatomic1 git && \
18
+ git config --global user.email "qinglong@@users.noreply.github.com" && \
19
+ git config --global user.name "qinglong" && \
20
+ git config --global http.postBuffer 524288000 && \
21
+ git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR}
22
+
23
+ RUN mkdir /tmp/build
24
+ RUN cp ${QL_DIR}/package.json ${QL_DIR}/.npmrc ${QL_DIR}/pnpm-lock.yaml /tmp/build/
25
+
26
+ RUN npm i -g [email protected] && \
27
+ cd /tmp/build && \
28
+ pnpm install --prod
29
+
30
+ FROM python:3.11-slim-bullseye
31
+
32
+ ARG QL_MAINTAINER="whyour"
33
+ LABEL maintainer="${QL_MAINTAINER}"
34
+ ARG QL_URL=https://github.com/${QL_MAINTAINER}/qinglong.git
35
+ ARG QL_BRANCH=debian
36
+
37
+ ENV PNPM_HOME=/root/.local/share/pnpm \
38
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/share/pnpm:/root/.local/share/pnpm/global/5/node_modules:$PNPM_HOME \
39
+ NODE_PATH=/usr/local/bin:/usr/local/pnpm-global/5/node_modules:/usr/local/lib/node_modules:/root/.local/share/pnpm/global/5/node_modules \
40
+ LANG=C.UTF-8 \
41
+ SHELL=/bin/bash \
42
+ PS1="\u@\h:\w \$ " \
43
+ QL_DIR=/ql \
44
+ QL_BRANCH=${QL_BRANCH}
45
+
46
+ COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
47
+ COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
48
+
49
+ RUN set -x && \
50
+ ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
51
+ ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
52
+ apt-get update && \
53
+ apt-get upgrade -y && \
54
+ apt-get install --no-install-recommends -y git \
55
+ curl \
56
+ cron \
57
+ wget \
58
+ tzdata \
59
+ perl \
60
+ openssl \
61
+ openssh-client \
62
+ nginx \
63
+ jq \
64
+ procps \
65
+ netcat \
66
+ libxslt-dev \
67
+ musl-dev \
68
+ libc-dev \
69
+ gcc \
70
+ g++ \
71
+ libffi-dev \
72
+ python3-dev \
73
+ sshpass \
74
+ rclone \
75
+ unzip \
76
+ libatomic1 && \
77
+ apt-get clean && \
78
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
79
+ echo "Asia/Shanghai" >/etc/timezone && \
80
+ git config --global user.email "qinglong@@users.noreply.github.com" && \
81
+ git config --global user.name "qinglong" && \
82
+ git config --global http.postBuffer 524288000 && \
83
+ npm install -g [email protected] pm2 ts-node && \
84
+ rm -rf /root/.pnpm-store && \
85
+ rm -rf /root/.local/share/pnpm/store && \
86
+ rm -rf /root/.cache && \
87
+ rm -rf /root/.npm && \
88
+ chmod u+s /usr/sbin/cron && \
89
+ ulimit -c 0
90
+
91
+ ARG SOURCE_COMMIT
92
+ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
93
+ cd ${QL_DIR} && \
94
+ cp -f .env.example .env && \
95
+ chmod 777 ${QL_DIR}/shell/*.sh && \
96
+ chmod 777 ${QL_DIR}/docker/*.sh && \
97
+ git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static && \
98
+ mkdir -p ${QL_DIR}/static && \
99
+ cp -rf /static/* ${QL_DIR}/static && \
100
+ rm -rf /static && \
101
+ rm -f ${QL_DIR}/docker/docker-entrypoint.sh
102
+
103
+ COPY docker-entrypoint.sh ${QL_DIR}/docker
104
+
105
+ RUN mkdir /ql/data && \
106
+ mkdir /ql/data/config && \
107
+ mkdir /ql/data/log && \
108
+ mkdir /ql/data/db && \
109
+ mkdir /ql/data/scripts && \
110
+ mkdir /ql/data/repo && \
111
+ mkdir /ql/data/raw && \
112
+ mkdir /ql/data/deps && \
113
+ chmod -R 777 /ql && \
114
+ chmod -R 777 /var && \
115
+ chmod -R 777 /usr/local && \
116
+ chmod -R 777 /etc/nginx && \
117
+ chmod -R 777 /run && \
118
+ chmod -R 777 /usr && \
119
+ chmod -R 777 /root
120
+
121
+ COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
122
+ COPY services.json /ql/node_modules/nodemailer/lib/well-known/
123
+ COPY notify.py /notify.py
124
+
125
+ WORKDIR ${QL_DIR}
126
+
127
+
128
+ # Set up a new user named "user" with user ID 1000
129
+ RUN useradd -m -u 1000 user
130
+
131
+ # Switch to the "user" user
132
+ USER user
133
+
134
+ # 创建rclone配置文件
135
+ RUN rclone config -h
136
+
137
+ HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
138
+ CMD curl -sf --noproxy '*' http://127.0.0.1:5400/api/health || exit 1
139
+
140
+ ENTRYPOINT ["./docker/docker-entrypoint.sh"]
141
+
142
+ VOLUME /ql/data
143
+
144
+ EXPOSE 5700