目录
[2.安装HBuild X工具](#2.安装HBuild X工具)
[二、HBuild X打包项目](#二、HBuild X打包项目)
[1.在HBuild X导入项目](#1.在HBuild X导入项目)

一、准备工作
1.Docker安装nginx
docker pull nginx
2.安装HBuild X工具
二、HBuild X打包项目
1.在HBuild X导入项目


2.配置manifest.json

3.打包
(1)点击发行

(2)填写信息,点击发行


三、nginx部署uniapp
1.生成文件上传到服务器


2.在同级目录下创建相关配置文件
(1)default.conf文件
a、创建
vim default.conf
b、添加内容
server {
listen 81;
server_name 111.111.11.111;
charset utf-8;
# 前端路径
location / {
#前端项目的路径在docker内部挂载的命令
root /usr/share/nginx/html/build/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

(2)Dockerfile
a、创建文件
vim Dockerfile
b、添加内容
# 使用nginx镜像
FROM nginx
# 作者
MAINTAINER cmh
# 删除nginx 默认配置
RUN rm /etc/nginx/conf.d/default.conf
# 添加我们自己的配置 default.conf 在下面
ADD default.conf /etc/nginx/conf.d/
# 把刚才生成dist文件夹下的文件copy到nginx下面去
COPY dist/ /usr/share/nginx/html/
3.打包镜像
docker build -t mall-app-web:1.0 .


4.创建容器运行
docker run -d --name mall-app-web1.0 -p 8089:81 mall-app-web:1.0


四、效果
