feat:添加Dockerfile和docker启动说明
parent
181a8af8fa
commit
69845a7638
|
@ -31,4 +31,5 @@ data/elasticsearch
|
|||
|
||||
.DS_Store
|
||||
dependency-reduced-pom.xml
|
||||
/data/plugins
|
||||
/data/plugins
|
||||
/data/dist
|
|
@ -0,0 +1,33 @@
|
|||
# 操作步骤:
|
||||
# 1. 打包前端项目,复制dis到data目录
|
||||
# 2. 打包java项目
|
||||
# 3. docker build -t iot-iita .
|
||||
# 4. docker tag iot-iita iotkits/iot-iita
|
||||
# 5. docker push iotkits/iot-iita
|
||||
|
||||
# 使用包含Java的基础镜像
|
||||
FROM adoptopenjdk:11-jre-hotspot
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制后端Java应用的JAR文件
|
||||
COPY ./iot-starter/target/iot-starter-0.5.2-SNAPSHOT.jar app.jar
|
||||
COPY ./data/init/* data/init/
|
||||
|
||||
# 安装Nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# 复制Nginx配置文件
|
||||
COPY ./data/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 复制静态资源
|
||||
COPY ./data/dist/ /usr/share/nginx/html
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8082 8086 1883 1884
|
||||
# 插件预留端口
|
||||
EXPOSE 8130-8140
|
||||
|
||||
# 设置容器启动命令
|
||||
CMD ["/bin/bash", "-c", "java -jar /app/app.jar & nginx -g 'daemon off;'"]
|
||||
|
10
README.md
10
README.md
|
@ -7,7 +7,7 @@
|
|||
<p align="center"><img src="https://img.shields.io/badge/JDK-11+-important.svg"> <img src="https://img.shields.io/badge/Redis-5.0-important.svg"> <img src="https://img.shields.io/badge/SpringBoot-2.6.2-blue.svg"> <img src="https://img.shields.io/badge/Elasticsearch-7.15.2-red.svg"> <img src="https://img.shields.io/badge/Satoken-1.30.0-yellow.svg">
|
||||
</p>
|
||||
<p align="center"><img src="https://img.shields.io/badge/License-Apache2.0-lightgrey.svg">
|
||||
<img src="https://img.shields.io/badge/Copyright-铱塔智联/openiita-60569f.svg"> <img src="https://img.shields.io/badge/v0.4.5-60569f.svg">
|
||||
<img src="https://img.shields.io/badge/Copyright-铱塔智联/openiita-60569f.svg"> <img src="https://img.shields.io/badge/v0.5.2-60569f.svg">
|
||||
<img src="https://img.shields.io/badge/物联网平台-f44e91.svg">
|
||||
</p>
|
||||
|
||||
|
@ -94,8 +94,14 @@ Vertx event-bus(内置)、RocketMQ,通过扩展模块可接入其它任意
|
|||
|
||||
2、application.xml中打开rocketmq配置
|
||||
|
||||
#### Docker运行
|
||||
docker pull iotkits/iot-iita:latest
|
||||
|
||||
#### 运行步骤
|
||||
docker run -p 8082:8082 -p 8086:8086 -p 8130-8140:8130-8140 iotkits/iot-iita:latest
|
||||
|
||||
启动后访问 http://localhost:8082/
|
||||
|
||||
#### 源码运行步骤
|
||||
1、安装jdk11
|
||||
|
||||
2、clone代码([核心库](https://gitee.com/open-iita/iot-iita-core),[主项目库](https://gitee.com/open-iita/iotkit-parent),[插件库](https://gitee.com/open-iita/iot-iita-plugins)),在idea中导入项目
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
user root;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
|
||||
include /usr/share/nginx/modules/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 4096;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server
|
||||
{
|
||||
listen 8082;
|
||||
server_name localhost;
|
||||
client_max_body_size 100m;
|
||||
index index.html;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
location /prod-api/
|
||||
{
|
||||
rewrite /api(.*) $1 break;
|
||||
proxy_pass http://127.0.0.1:8086/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue