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