mc6 commited on
Commit
821d815
·
verified ·
1 Parent(s): 3240932

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +180 -0
Dockerfile ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ sudo \
57
+ build-essential \
58
+ default-jdk \
59
+ default-jre \
60
+ g++ \
61
+ gcc \
62
+ libzbar0 \
63
+ fish \
64
+ ffmpeg \
65
+ nmap \
66
+ ca-certificates \
67
+ zsh \
68
+ cron \
69
+ wget \
70
+ tzdata \
71
+ perl \
72
+ openssl \
73
+ openssh-client \
74
+ nginx \
75
+ jq \
76
+ procps \
77
+ netcat \
78
+ sshpass \
79
+ rclone \
80
+ unzip \
81
+ libatomic1 && \
82
+ apt-get clean && \
83
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
84
+ echo "Asia/Shanghai" >/etc/timezone && \
85
+ git config --global user.email "qinglong@@users.noreply.github.com" && \
86
+ git config --global user.name "qinglong" && \
87
+ git config --global http.postBuffer 524288000 && \
88
+ npm install -g [email protected] pm2 ts-node && \
89
+ rm -rf /root/.pnpm-store && \
90
+ rm -rf /root/.local/share/pnpm/store && \
91
+ rm -rf /root/.cache && \
92
+ rm -rf /root/.npm && \
93
+ chmod u+s /usr/sbin/cron && \
94
+ ulimit -c 0
95
+
96
+
97
+ # Install code-server
98
+ RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.96.4
99
+
100
+ # Install ollama
101
+ RUN curl -fsSL https://ollama.com/install.sh | sh
102
+
103
+
104
+ ARG SOURCE_COMMIT
105
+ RUN git clone --depth=1 -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} && \
106
+ cd ${QL_DIR} && \
107
+ cp -f .env.example .env && \
108
+ chmod 777 ${QL_DIR}/shell/*.sh && \
109
+ chmod 777 ${QL_DIR}/docker/*.sh && \
110
+ git clone --depth=1 -b ${QL_BRANCH} https://github.com/${QL_MAINTAINER}/qinglong-static.git /static && \
111
+ mkdir -p ${QL_DIR}/static && \
112
+ cp -rf /static/* ${QL_DIR}/static && \
113
+ rm -rf /static && \
114
+ rm -f ${QL_DIR}/docker/docker-entrypoint.sh
115
+
116
+ COPY docker-entrypoint.sh ${QL_DIR}/docker
117
+ COPY front.conf ${QL_DIR}/docker/front.conf
118
+
119
+ RUN mkdir /ql/data && \
120
+ mkdir /ql/data/config && \
121
+ mkdir /ql/data/log && \
122
+ mkdir /ql/data/db && \
123
+ mkdir /ql/data/scripts && \
124
+ mkdir /ql/data/repo && \
125
+ mkdir /ql/data/raw && \
126
+ mkdir /ql/data/deps && \
127
+ chmod -R 777 /ql && \
128
+ chmod -R 777 /var && \
129
+ chmod -R 777 /usr/local && \
130
+ chmod -R 777 /etc/nginx && \
131
+ chmod -R 777 /run && \
132
+ chmod -R 777 /usr && \
133
+ chmod -R 777 /root
134
+
135
+ COPY --from=builder /tmp/build/node_modules/. /ql/node_modules/
136
+ COPY services.json /ql/node_modules/nodemailer/lib/well-known/
137
+ COPY notify.py /notify.py
138
+
139
+
140
+
141
+ # Create a user to run code-server
142
+ RUN useradd -m -s /bin/zsh coder && \
143
+ echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
144
+
145
+ # Create code-server configuration directory
146
+ RUN mkdir -p /home/coder/.local/share/code-server/User
147
+ RUN chmod -R 777 /home/coder
148
+
149
+ # Add settings.json to enable dark mode
150
+ RUN echo '{ \
151
+ "workbench.colorTheme": "Default Dark Modern", \
152
+ "telemetry.enableTelemetry": true, \
153
+ "telemetry.enableCrashReporter": true \
154
+ }' > /home/coder/.local/share/code-server/User/settings.json
155
+
156
+ # Change ownership of the configuration directory
157
+ RUN chown -R coder:coder /home/coder/.local/share/code-server
158
+
159
+ # Install Python extension for code-server
160
+ #RUN sudo -u coder code-server --install-extension ms-python.python
161
+
162
+ # Switch to the coder user for running code-server
163
+ USER coder
164
+
165
+ ENV HOME=/home/coder \
166
+ PATH=/home/coder/.local/bin:$PATH
167
+
168
+ WORKDIR ${QL_DIR}
169
+
170
+ # 创建rclone配置文件
171
+ RUN rclone config -h
172
+
173
+ HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
174
+ CMD curl -sf --noproxy '*' http://127.0.0.1:5400/api/health || exit 1
175
+
176
+ ENTRYPOINT ["./docker/docker-entrypoint.sh"]
177
+
178
+ VOLUME /ql/data
179
+
180
+ EXPOSE 5700