[Why] use node:alpine as a Builder for build h5ai we can reduce install app such: nginx, node, npm to save deploy time
Signed-off-by: Lu Weitao luweitaobe@163.com --- container/srv-http/Dockerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/container/srv-http/Dockerfile b/container/srv-http/Dockerfile index 6564730..b7d0677 100644 --- a/container/srv-http/Dockerfile +++ b/container/srv-http/Dockerfile @@ -1,25 +1,32 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-FROM alpine:3.9 +FROM node:alpine as Builder + +MAINTAINER Lu Weitao luweitaobe@163.com + +RUN apk add git + +RUN git clone https://gitee.com/luweitao_y/h5ai.git /h5ai + +WORKDIR /h5ai + +RUN npm install && \ + npm run build + +FROM nginx:alpine
ADD root /
-RUN apk add --no-cache nginx php7 php7-fpm php7-session php7-json php7-exif php7-imagick php7-gd php7-fileinfo nodejs npm git \ - && mkdir /run/nginx/ +RUN apk add --no-cache php7 php7-fpm php7-session php7-json php7-exif php7-imagick php7-gd php7-fileinfo
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 git clone https://gitee.com/luweitao_y/h5ai.git /h5ai
-WORKDIR /h5ai +COPY --from=Builder /h5ai/build/_h5ai /srv/_h5ai
-# build h5ai package -RUN npm install \ - && npm run build \ - && cp -r ./build/_h5ai /srv \ - && chown -R nginx:nginx /srv/_h5ai +RUN chown -R nginx:nginx /srv/_h5ai
ENTRYPOINT ["/sbin/entrypoint.sh"]