docker构建node镜像

一、Nuxt项目构建镜像发布

1、在Dockerfile中添加以下内容

FROM  registry.cn-hangzhou.aliyuncs.com/insoz/node:git

RUN git clone https://userName:[email protected]/userName/show_sir_nuxt.git \
    && cd show_sir_nuxt \
    && yarn install \
	&& yarn build

WORKDIR /show_sir_nuxt

EXPOSE 80

ENTRYPOINT [ "yarn", "start" ]

2、构建镜像命令

docker build -t show_sir_nuxt:v1 .

3、运行镜像命令,项目的端口是3000,宿主机对外的端口是5000

docker run -d -p 5000:3000 --name show_sir_nuxt show_sir_nuxt:v1

4、访问地址http://192.168.1.221:5000/

二、umi项目构建镜像发布

在Dockerfile中添加以下内容

FROM  registry.cn-hangzhou.aliyuncs.com/insoz/node:git

RUN git clone https://userName:[email protected]/userName/show-cms.git \
    && cd show-cms \
    && yarn install \
	&& yarn build

WORKDIR /show-cms

EXPOSE 80

ENTRYPOINT [ "yarn", "start" ]

猜你喜欢

转载自blog.csdn.net/qq_42714869/article/details/88644628