1
0
Files
omc_api/docker/README.md
2024-02-07 12:33:09 +08:00

67 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Docker 编译
编译目录内含 `frontend``backend` 两个项目代码,将后端项目代码中的 `backend/docker/Dockerfile` 文件移动到最外层目录下。
编译目录结构
```text
omc
├── frontend 目录-前端项目代码
├── backend 目录-后端项目代码
└── Dockerfile 文件-Docker编译需要
```
## 打包
- `VERSION` 变量是后端程序打包版本号注入
```sh
docker build --build-arg VERSION="2.240112" -t omc:2.240112 .
```
## 部署
- `APPENV` 程序启动环境变量 local、prod -e APPENV="local"
```sh
docker run -d \
--privileged=true \
--restart=always \
-p 3222:22 \
-p 3280:80 \
-p 3230:3030 \
-p 3260:6060 \
-v /home/mask/Probject/omc/omc:/usr/local/omc \
-v /home/mask/Probject/omc/logs:/var/log/omc \
-e TZ="Asia/Shanghai" \
-m 512M \
--name omc_002 \
omc:2.240112
```
## 镜像导出导入
```sh
docker save omc:2.240112 -o omc_r2.240112.tar
docker load -i omc_r2.240112.tar
```
## 调试
```sh
docker run -it omcxxx sh
docker exec -it omxxx sh
/usr/sbin/sshd && nginx -c /usr/local/omc/nginx/nginx.conf && /usr/local/omc/bin/backend --env prod -c /usr/local/omc/etc/omc.yaml
```