mabike commited on
Commit
3beb074
1 Parent(s): 2761a56

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +135 -0
Dockerfile ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ sshpass \
67
+ rclone \
68
+ unzip \
69
+ libatomic1 && \
70
+ apt-get clean && \
71
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
72
+ echo "Asia/Shanghai" >/etc/timezone && \
73
+ git config --global user.email "qinglong@@users.noreply.github.com" && \
74
+ git config --global user.name "qinglong" && \
75
+ git config --global http.postBuffer 524288000 && \
76
+ npm install -g [email protected] pm2 ts-node && \
77
+ rm -rf /root/.pnpm-store && \
78
+ rm -rf /root/.local/share/pnpm/store && \
79
+ rm -rf /root/.cache && \
80
+ rm -rf /root/.npm && \
81
+ chmod u+s /usr/sbin/cron && \
82
+ ulimit -c 0
83
+
84
+ ARG SOURCE_COMMIT
85
+ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
86
+ cd ${QL_DIR} && \
87
+ cp -f .env.example .env && \
88
+ chmod 777 ${QL_DIR}/shell/*.sh && \
89
+ chmod 777 ${QL_DIR}/docker/*.sh && \
90
+ git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static && \
91
+ mkdir -p ${QL_DIR}/static && \
92
+ cp -rf /static/* ${QL_DIR}/static && \
93
+ rm -rf /static && \
94
+ rm -f ${QL_DIR}/docker/docker-entrypoint.sh
95
+
96
+ COPY docker-entrypoint.sh ${QL_DIR}/docker
97
+
98
+ RUN mkdir /ql/data && \
99
+ mkdir /ql/data/config && \
100
+ mkdir /ql/data/log && \
101
+ mkdir /ql/data/db && \
102
+ mkdir /ql/data/scripts && \
103
+ mkdir /ql/data/repo && \
104
+ mkdir /ql/data/raw && \
105
+ mkdir /ql/data/deps && \
106
+ chmod -R 777 /ql && \
107
+ chmod -R 777 /var && \
108
+ chmod -R 777 /usr/local && \
109
+ chmod -R 777 /etc/nginx && \
110
+ chmod -R 777 /run && \
111
+ chmod -R 777 /usr && \
112
+ chmod -R 777 /root
113
+
114
+ COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
115
+
116
+ WORKDIR ${QL_DIR}
117
+
118
+
119
+ # Set up a new user named "user" with user ID 1000
120
+ RUN useradd -m -u 1000 user
121
+
122
+ # Switch to the "user" user
123
+ USER user
124
+
125
+ # 创建rclone配置文件
126
+ RUN rclone config -h
127
+
128
+ HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
129
+ CMD curl -sf --noproxy '*' http://127.0.0.1:5400/api/health || exit 1
130
+
131
+ ENTRYPOINT ["./docker/docker-entrypoint.sh"]
132
+
133
+ VOLUME /ql/data
134
+
135
+ EXPOSE 5700