-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.riscv
380 lines (307 loc) · 14.4 KB
/
Dockerfile.riscv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# Copyright (c) 2022 Institute of Software, Chinese Academy of Sciences (ISCAS)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:22.04 AS builder1
# 更换APT源为中科大源
RUN sed -i.bak 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.ustc.edu.cn/ubuntu/|g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates-java \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get install -y --reinstall ca-certificates-java
WORKDIR /work/
COPY . .
ENV LANG C.UTF-8
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
# get all sources
RUN apt-get update; \
apt-get install git make -y \
&& rm -rf /var/lib/apt/lists/*
# # for space-filepreview
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-filepreview.git
# for space-aofs
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-aofs.git
# for space-upgrade
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-upgrade.git
# for space-agent
# RUN git clone --branch ospp --single-branch https://github.com/Gui-Yue/space-agent.git
# for space-space-media-vod
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-media-vod.git
# for space-gateway
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-gateway.git
# for space-postgresql
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-postgresql.git
# for space-web
# RUN git clone --branch dev --single-branch https://github.com/ao-space/space-web.git
# creat binary floder
RUN mkdir object-binary
# # compile for space-filepreview
# RUN mv space-filepreview object-binary
# compile for for space-aofs
RUN apt-get update -y \
&& apt-get install golang-any -y; \
cd space-aofs; \
go env -w CGO_ENABLED=0 \
&& go env -w GO111MODULE=on \
&& go env -w GOPROXY="https://goproxy.io,direct" \
&& go build -o space-aofs
RUN mkdir object-binary/space-aofs; \
rm -rf /var/lib/apt/lists/*; \
cp -r space-aofs/template object-binary/space-aofs; \
cp space-aofs/space-aofs object-binary/space-aofs
# compile for space-upgrade
# RUN apt-get update && apt-get install -y make; \
# cd space-upgrade \
# && make -f Makefile
# RUN mkdir object-binary/space-upgrade; \
# mv space-upgrade/build/eulixspace-upgrade object-binary/space-upgrade
# # compile for space-media-vod
# RUN apt-get update \
# && apt-get install -y curl gcc openssl libssl-dev zlib1g-dev libssl-dev libavcodec-dev linux-headers-generic libpcre3-dev libpcre2-dev git make \
# libswscale-dev libavfilter-dev libxml2-dev; \
# mkdir space-media-vod/nginx; \
# cd space-media-vod; \
# git clone https://github.com/ao-space/nginx-vod-module.git
# ARG NGINX_VERSION=1.23.0
# ARG VOD_MODULE_VERSION=d96b61febe06f147f937dde721921f2d2206c6bc
# RUN apt-get update \
# && apt-get install -y curl tar
# USER root
# RUN curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C space-media-vod/nginx --strip 1 -xz --no-same-owner --no-same-permissions; \
# ls space-media-vod
# RUN cd space-media-vod/nginx; \
# ./configure --prefix=/usr/local/nginx \
# --add-module=../nginx-vod-module \
# --with-http_ssl_module \
# --with-file-aio \
# --with-threads \
# --with-cc-opt="-O3 -Wno-deprecated-declarations"; \
# make; \
# make install; \
# ls /usr/local; \
# rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
# RUN mkdir object-binary/space-media-vod; \
# cp -r /usr/local/nginx object-binary/space-media-vod; \
# ls object-binary/space-media-vod; \
# cp space-media-vod/nginx.conf object-binary/space-media-vod
# compile for space-gateway
RUN timeout 600s apt-get update -y \
&& timeout 1200s apt-get install openjdk-17-jdk -y
RUN mkdir object-binary/space-gateway; \
cp -r resource_for_gateway/deployments object-binary/space-gateway
# compile for space-postgresql
RUN apt-get update && apt-get install -y \
tzdata \
dos2unix \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN cd space-postgresql; \
dos2unix -k update-pg-password.sh docker-entrypoint.sh eulixspace_pgsql_init.sh
RUN mkdir object-binary/space-postgresql; \
cp space-postgresql/*.sh object-binary/space-postgresql
# copy resource for space-web
RUN mkdir object-binary/space-web; \
cp space-web/nginx.conf.template object-binary/space-web; \
cp space-web/verify_access_token.lua object-binary/space-web; \
cp space-web/cert.crt object-binary/space-web; \
cp space-web/private.key object-binary/space-web; \
cp -r resource_for_web/space object-binary/space-web; \
cp space-web/docker-entrypoint.sh object-binary/space-web
# compile for space-agent
RUN apt-get update \
&& apt-get install -y zip
# maybe commands below is not essential.
# RUN cd space-agent/web/boxdocker && npm install && npm run build && mv dist boxdocker && \
# zip -r static_html.zip boxdocker && mv static_html.zip ../../res
RUN cd space-agent; \
go env -w GO111MODULE=on && go env -w GOPROXY="https://goproxy.io,direct" && make -f Makefile
RUN mkdir object-binary/space-agent; \
cp space-agent/build/aospace object-binary/space-agent; \
cp space-agent/supervisord.conf object-binary/space-agent
RUN apt remove docker.io -y; \
rm -rf /var/lib/apt/lists/*
# clean no longer needed source
RUN rm -rf space-*
# Install openresty for space-web
FROM xfan1024/openeuler:23.03-light as builder2
# 使用中国科学技术大学的镜像替换默认的 dnf 源
RUN sed -i.bak 's|http://repo.openeuler.org/|http://mirrors.ustc.edu.cn/openeuler/|' /etc/yum.repos.d/openEuler.repo
RUN dnf clean all \
&& dnf makecache
RUN yum update \
&& yum install openresty -y
FROM ubuntu:22.04 as builder3
# 更换APT源为中科大源
RUN sed -i.bak 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.ustc.edu.cn/ubuntu/|g' /etc/apt/sources.list
WORKDIR /workdir/
# install all dependence for starting all services
# # space-filepreview
# RUN set -eux; \
# apt-get update; \
# apt-get install -y --no-install-recommends libc6;\
# apt-get install -y --no-install-recommends \
# ca-certificates \
# netbase \
# tzdata \
# gcc g++ python3 python3-pip python3-full python3-dev; \
# apt-get clean;\
# rm -rf /var/lib/apt/lists/*
# RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime; \
# echo ${TZ} > /etc/timezone; \
# dpkg-reconfigure --frontend noninteractive tzdata; \
# rm -rf /var/lib/apt/lists/*
# RUN apt-get update && apt-get install --no-install-recommends \
# apt-transport-https ca-certificates poppler-utils qpdf \
# libfile-mimeinfo-perl libimage-exiftool-perl ghostscript \
# libsecret-1-0 zlib1g-dev libjpeg-dev ffmpeg python3-magic \
# libmagickwand-dev imagemagick -y \
# && rm -rf /var/lib/apt/lists/*
# COPY --from=builder1 /work/object-binary/space-filepreview ./
# RUN ls && pwd
# RUN pip3 install -r ./requirements.txt --break-system-packages -i https://mirrors.aliyun.com/pypi/simple/
# space-aofs
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ntfs-3g \
util-linux \
exfat-fuse \
exfatprogs \
usbutils \
mediainfo \
udev \
dos2unix \
jq \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq \
&& chmod +x /usr/bin/yq && yq --version
# # space-upgrade
# RUN set -eux; \
# apt-get update; \
# apt-get install -y --no-install-recommends \
# ca-certificates \
# netbase \
# tzdata \
# iputils-ping \
# ; \
# apt remove docker.io -y ; \
# rm -rf /var/lib/apt/lists/*
# space-agent
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
tzdata \
supervisor \
iputils-ping \
docker-compose \
curl \
cron \
; \
apt remove docker.io -y ; \
rm -rf /var/lib/apt/lists/*
# space-media-vod
# RUN apt-get install -y ca-certificates openssl; \
# rm -rf /var/lib/apt/lists/*
# space-gateway
RUN apt-get update \
&& apt-get install -y openjdk-17-jdk
# space-postgresql
RUN apt-get update \
&& apt-get install postgresql postgresql-contrib -y
# RUN find /usr/lib/postgresql/16/bin -type f -exec ln -s {} /usr/local/bin/ \;
RUN find /usr/lib/postgresql/*/bin -type f -exec ln -s {} /usr/local/bin/ \;
RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
# space-web
RUN apt-get update \
&& apt-get install acl manpages systemd util-linux diffutils x11-xkb-utils -y
COPY --from=builder2 /usr/local/openresty /usr/local/openresty
COPY --from=builder2 /etc/init.d/openresty /etc/init.d/openresty
COPY --from=builder2 /usr/bin/openresty /usr/bin/openresty
COPY --from=builder2 /usr/libexec/initscripts /usr/libexec/initscripts
COPY --from=builder2 /usr/sbin/service /usr/sbin/service
COPY --from=builder2 /usr/share/man/man8/service.8.gz /usr/share/man/man8/service.8.gz
COPY --from=builder2 /usr/lib64/libkmod.so.2 /usr/lib64/libkmod.so.2
COPY --from=builder2 /usr/lib64/libkmod.so.2.4.0 /usr/lib64/libkmod.so.2.4.0
COPY --from=builder2 /usr/share/licenses/kmod-libs /usr/share/licenses/kmod-libs
COPY --from=builder2 /usr/lib64/libfdisk.so.1 /usr/lib64/libfdisk.so.1
COPY --from=builder2 /usr/lib64/libfdisk.so.1.1.0 /usr/lib64/libfdisk.so.1.1.0
COPY --from=builder2 /usr/share/licenses/libfdisk /usr/share/licenses/libfdisk
COPY --from=builder2 /usr/lib64/libseccomp.so.2 /usr/lib64/libseccomp.so.2
COPY --from=builder2 /usr/lib64/libseccomp.so.2.5.4 /usr/lib64/libseccomp.so.2.5.4
COPY --from=builder2 /usr/share/doc/libseccomp /usr/share/doc/libseccomp
COPY --from=builder2 /usr/lib64/libutempter.so.0 /usr/lib64/libutempter.so.0
COPY --from=builder2 /usr/lib64/libutempter.so.1.2.1 /usr/lib64/libutempter.so.1.2.1
COPY --from=builder2 /usr/libexec/utempter /usr/libexec/utempter
COPY --from=builder2 /usr/share/doc/libutempter /usr/share/doc/libutempter
COPY --from=builder2 /usr/local/openresty/openssl111 /usr/local/openresty/openssl111
COPY --from=builder2 /usr/local/openresty/pcre /usr/local/openresty/pcre
COPY --from=builder2 /usr/lib64/libxkbcommon.so.0 /usr/lib64/libxkbcommon.so.0
COPY --from=builder2 /usr/lib64/libxkbcommon.so.0.0.0 /usr/lib64/libxkbcommon.so.0.0.0
COPY --from=builder2 /usr/lib64/libxkbregistry.so.0 /usr/lib64/libxkbregistry.so.0
COPY --from=builder2 /usr/lib64/libxkbregistry.so.0.0.0 /usr/lib64/libxkbregistry.so.0.0.0
COPY --from=builder2 /usr/share/licenses/libxkbcommon /usr/share/licenses/libxkbcommon
COPY --from=builder1 /work/yq /usr/bin/
RUN chmod +x /usr/bin/yq
ENV PATH=/usr/local/openresty/bin:$PATH
# install services
# aospace-redis
RUN apt-get update -y \
&& apt-get install redis-server postgresql-client -y
# space-filepreview
# python project no installation required
# space-aofs
COPY --from=builder1 /work/object-binary/space-aofs/space-aofs /usr/bin
COPY --from=builder1 /work/object-binary/space-aofs/template /tmp/
RUN chmod +x /usr/bin/space-aofs
# space-upgrade
# COPY --from=builder1 /work/object-binary/space-upgrade/eulixspace-upgrade /usr/local/bin/eulixspace-upgrade
# space-media-vod
# COPY --from=builder1 /work/object-binary/space-media-vod/nginx /usr/local/nginx
# COPY --from=builder1 /work/object-binary/space-media-vod/nginx.conf /usr/local/nginx/conf/nginx.conf
# space-gateway
USER root
ENV JAVA_OPTS="-Duser.timezone=GMT+8 -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
COPY --chown=1001 --from=builder1 /work/object-binary/space-gateway/deployments /deployments
# space-postgresql
COPY --from=builder1 /work/object-binary/space-postgresql/update-pg-password.sh /usr/local/bin
COPY --from=builder1 /work/object-binary/space-postgresql/eulixspace_pgsql_init.sh /docker-entrypoint-initdb.d/10_eulixspace.sh
COPY --from=builder1 /work/object-binary/space-postgresql/docker-entrypoint.sh /usr/local/bin
RUN sed -i '1s|#!/bin/sh|#!/bin/bash|' /usr/local/bin/update-pg-password.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/update-pg-password.sh
RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh
# space-web
COPY --from=builder1 /work/object-binary/space-web/nginx.conf.template /nginx.conf.template
COPY --from=builder1 /work/object-binary/space-web/verify_access_token.lua /etc/nginx/verify_access_token.lua
COPY --from=builder1 /work/object-binary/space-web/cert.crt /etc/nginx/certs/cert.pem
COPY --from=builder1 /work/object-binary/space-web/private.key /etc/nginx/certs/cert.key
RUN mkdir -p /opt/eulixspace-web/space/ /opt/eulixspace-web/share/
COPY --from=builder1 /work/object-binary/space-web/space /opt/eulixspace-web/space
COPY --from=builder1 /work/object-binary/space-web/docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
# space-agent
COPY --from=builder1 /work/object-binary/space-agent/aospace /usr/local/bin/aospace
COPY --from=builder1 /work/object-binary/space-agent/supervisord.conf /etc/supervisor/supervisord.conf
# 设置启动脚本
COPY --from=builder1 /work/prestart.sh /usr/local/bin/prestart.sh
COPY --from=builder1 /work/start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/prestart.sh
RUN chmod +x /usr/local/bin/start.sh
RUN dos2unix /usr/local/bin/*sh
RUN dos2unix /*sh
# 暴露必要的端口
EXPOSE 80 443 5432 6379 3001 2001 8080 5678
# 使用启动脚本作为入口点
ENTRYPOINT ["/usr/local/bin/prestart.sh"]