美文网首页
UmiJS打包一个镜像包适用于不同环境

UmiJS打包一个镜像包适用于不同环境

作者: Poppy11 | 来源:发表于2022-02-25 16:22 被阅读0次

1、本地代码创建不同nginx配置

image.png
nginx配置信息
server {
    listen 8080;
    absolute_redirect off;
    # gzip config
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 9;
    gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";

    root /usr/share/nginx/dist;
    index index.html index.htm;

    location / {
        client_max_body_size 200M;
        try_files $uri $uri/ /index.html;
    }

    location /api/ {
        client_max_body_size 200M;
        proxy_pass  https://apis-dev.newegg.org/;
    }

    location /dashboardApi/{
        client_max_body_size 200M;
        proxy_pass  https://apis.newegg.org/;
    }

    location /nas/{
        client_max_body_size 200M;
        proxy_pass  https://10.16.75.22:9898/03m8z6l4m9z0f2cy1lg3hupb3t/;
    }
}

2、创建Dockerfile

FROM harbor.newegg.org/base/nginx-unprivileged:stable-alpine
COPY nginx.*.conf /etc/nginx/dolphin-portal/
COPY --chown=nginx:nginx config.sh /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.d/config.sh
COPY --chown=nginx:nginx /dist /usr/share/nginx/dist

3、编写config.sh脚本

#!/bin/sh
set -e

location=${LOCATION}

if [ ! "${location}" ]; then
    echo "location not set!"
    exit 1
fi

echo "LOCATION: ${location}"

# replace nginx conf file
cp -f /etc/nginx/dolphin-portal/nginx.${location}.conf /etc/nginx/conf.d

4、在机器上设置对应环境字段

相关文章

  • UmiJS打包一个镜像包适用于不同环境

    1、本地代码创建不同nginx配置 nginx配置信息 2、创建Dockerfile 3、编写config.sh脚...

  • docker介绍

    docker相关的概念: 镜像:把操作系统、软件、环境变量打包成一个包,就是镜像,在镜像里面,类似一个虚拟机。 仓...

  • python项目代码打包成Docker镜像

    适用于本地已有python开发环境(python,pip 等), 需要把整个项目打包成docker镜像便于发布。 ...

  • 6. Docker镜像

    Docker镜像 是什么 镜像是一种轻量级、可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件,它包...

  • Docker制作镜像

    一: commit 打包镜像(适用于制作简单镜像) docker commit 容器id 新镜像名称:标签 ...

  • 【docker专栏3】docker基础概念-容器、镜像以及引擎组

    一、docker镜像与容器 docker镜像是一个可执行的静态独立软件包,包含打包程序代码和软件运行环境等文件。如...

  • Docker镜像讲解

    镜像是什么 镜像是以重轻量级、可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件,它包含运行某个软件...

  • 【现学现忘Docker基础】— 18.Docker镜像的加载原理

    1、镜像是什么 镜像是一种轻量级、可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件,它包含运行某个...

  • Docker镜像制作指导书

    基本原理 1、镜像是什么 镜像是一种轻量级、可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件...

  • docker镜像讲解

    镜像是什么? 镜像是一种轻量级、可执行的独立软件包,用来打包软件运行环境和基于环境开发的软件,它包含运行某个软件所...

网友评论

      本文标题:UmiJS打包一个镜像包适用于不同环境

      本文链接:https://www.haomeiwen.com/subject/avnxrrtx.html