pcp356 commited on
Commit
a0a0476
1 Parent(s): 67cc723

Create Dockerfile

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