ykxVK8yL5L
commited on
Commit
•
3f0eb38
1
Parent(s):
234c05e
Create Dockerfile
Browse files- Dockerfile +97 -0
Dockerfile
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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=develop
|
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 |
+
wget \
|
42 |
+
tzdata \
|
43 |
+
perl \
|
44 |
+
openssl \
|
45 |
+
openssh-client \
|
46 |
+
nginx \
|
47 |
+
jq \
|
48 |
+
procps \
|
49 |
+
netcat \
|
50 |
+
unzip \
|
51 |
+
libatomic1 && \
|
52 |
+
apt-get clean && \
|
53 |
+
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
54 |
+
echo "Asia/Shanghai" >/etc/timezone && \
|
55 |
+
git config --global user.email "qinglong@@users.noreply.github.com" && \
|
56 |
+
git config --global user.name "qinglong" && \
|
57 |
+
git config --global http.postBuffer 524288000 && \
|
58 |
+
npm install -g [email protected] pm2 ts-node && \
|
59 |
+
rm -rf /root/.pnpm-store && \
|
60 |
+
rm -rf /root/.local/share/pnpm/store && \
|
61 |
+
rm -rf /root/.cache && \
|
62 |
+
rm -rf /root/.npm && \
|
63 |
+
ulimit -c 0
|
64 |
+
|
65 |
+
ARG SOURCE_COMMIT
|
66 |
+
RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
|
67 |
+
cd ${QL_DIR} && \
|
68 |
+
cp -f .env.example .env && \
|
69 |
+
chmod 777 -R /ql \
|
70 |
+
chmod 777 -R /root \
|
71 |
+
chmod 777 ${QL_DIR}/shell/*.sh && \
|
72 |
+
chmod 777 ${QL_DIR}/docker/*.sh && \
|
73 |
+
git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static && \
|
74 |
+
mkdir -p ${QL_DIR}/static && \
|
75 |
+
cp -rf /static/* ${QL_DIR}/static && \
|
76 |
+
rm -rf /static
|
77 |
+
|
78 |
+
COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
|
79 |
+
|
80 |
+
WORKDIR ${QL_DIR}
|
81 |
+
|
82 |
+
|
83 |
+
# Set up a new user named "user" with user ID 1000
|
84 |
+
RUN useradd -m -u 1000 user
|
85 |
+
|
86 |
+
# Switch to the "user" user
|
87 |
+
USER user
|
88 |
+
|
89 |
+
|
90 |
+
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
|
91 |
+
CMD curl -sf --noproxy '*' http://127.0.0.1:5400/api/health || exit 1
|
92 |
+
|
93 |
+
ENTRYPOINT ["./docker/docker-entrypoint.sh"]
|
94 |
+
|
95 |
+
VOLUME /ql/data
|
96 |
+
|
97 |
+
EXPOSE 5700
|