On Wed, Dec 30, 2020 at 05:49:10PM +0800, Lu Weitao wrote:
可以把构建h5ai的动作单独放在另外一个container里面比如h5ai,这个container只用写Dockerfile和build,install,类似container/qemu-efi, srv-http build的时候就依赖这个容器。
Thanks, Yinsi
[Why] Optimize all pages style to make it more modern
Signed-off-by: Lu Weitao luweitaobe@163.com
container/srv-http/Dockerfile | 16 +++++++++++++--- container/srv-http/build | 7 +++++++ .../srv-http/root/etc/nginx/conf.d/default.conf | 5 ++--- 3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/container/srv-http/Dockerfile b/container/srv-http/Dockerfile index 8f9a36d..987e40e 100644 --- a/container/srv-http/Dockerfile +++ b/container/srv-http/Dockerfile @@ -1,15 +1,25 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-FROM nginx:alpine +FROM alpine:3.9
ADD root /
-RUN apk add --no-cache php7 php7-fpm php7-session php7-json php7-exif php7-imagick php7-gd php7-fileinfo +RUN apk add --no-cache nginx php7 php7-fpm php7-session php7-json php7-exif php7-imagick php7-gd php7-fileinfo nodejs npm \
- && mkdir /run/nginx/ \
- && mkdir /h5ai
RUN sed -i '/[global]/a daemonize = no' /etc/php7/php-fpm.conf RUN sed -i "s/user = nobody/user = nginx/g" /etc/php7/php-fpm.d/www.conf RUN sed -i "s/group = nobody/group = nginx/g" /etc/php7/php-fpm.d/www.conf
-RUN chown -R nginx:nginx /srv/_h5ai +WORKDIR /h5ai +COPY h5ai /h5ai
+# build h5ai package +RUN npm install \
- && npm run build \
- && cp -r ./build/_h5ai /srv \
- && chown -R nginx:nginx /srv/_h5ai
ENTRYPOINT ["/sbin/entrypoint.sh"] diff --git a/container/srv-http/build b/container/srv-http/build index 3a500ea..7b0ea74 100755 --- a/container/srv-http/build +++ b/container/srv-http/build @@ -2,4 +2,11 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+[[ $H5AI_SRC ]] || H5AI_SRC=/c/h5ai
+cp -r $H5AI_SRC ./
docker build -t srv-http .
+# clean h5ai folder +rm -rf ./h5ai diff --git a/container/srv-http/root/etc/nginx/conf.d/default.conf b/container/srv-http/root/etc/nginx/conf.d/default.conf index 676418a..646eee3 100644 --- a/container/srv-http/root/etc/nginx/conf.d/default.conf +++ b/container/srv-http/root/etc/nginx/conf.d/default.conf @@ -3,8 +3,8 @@ server { server_name "srv-http"; server_tokens off;
- root /usr/share/nginx/html;
- index index.html;
root /srv;
index index.html index.php /_h5ai/public/index.php;
charset utf-8,gbk;
@@ -24,7 +24,6 @@ server { autoindex on; autoindex_localtime on; allow all;
- root /srv; location ~* /[-_a-z]+$ { add_header Content-Type text/plain; }
-- 2.23.0