Dockerfile 文件配置

FROM anapsix/alpine-java:8_server-jre_unlimitedMAINTAINER Lion LiRUN mkdir -p /data/sydatasource/logs \/data/sydatasource/temp \/data/skywalking/agentWORKDIR /data/sydatasourceENV SERVER_PORT=8220EXPOSE ${SERVER_PORT}ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms256m -Xmx512m"ADD ./target/nacos.jar ./app.jarENTRYPOINT ["java", \"-Djava.security.egd=file:/dev/./urandom", \"-Dserver.port=${SERVER_PORT}", \#"-Dskywalking.agent.service_name=data", \#"-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \"-jar", "app.jar"]

docker-compnose.xml 文件配置

version: '3'services:mysql:image: mysql:8.0.31container_name: mysqlenvironment:# 时区上海TZ: Asia/Shanghai# root 密码MYSQL_ROOT_PASSWORD: XXXXXX# 初始化数据库MYSQL_DATABASE: mysql_nameports:- "3306:3306"volumes:# 数据挂载- /home/docker/mysql/data/:/var/lib/mysql/# 配置挂载- /home/mysql/conf/:/etc/mysql/conf.d/command:# 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)--default-authentication-plugin=mysql_native_password--character-set-server=utf8mb4--collation-server=utf8mb4_general_ci--explicit_defaults_for_timestamp=true--lower_case_table_names=1privileged: truenacos:image: nacos:1.0.0container_name: nacosports:- "8848:8848"- "9848:9848"- "9849:9849"environment:TZ: Asia/ShanghaiJAVA_OPTS: "-Xms256m -Xmx512m"volumes:# 日志目录 注意集群模式下 日志目录不能一致 需要区分例如 nacos1 nacos2- /home/nacos/logs/:/root/nacos/logs# 集群配置文件 集群所有nacos都必须使用此文件- /home/nacos/conf/cluster.conf:/root/nacos/conf/cluster.confnetwork_mode: "host"redis:image: redis:6.2.7container_name: redisports:- "6379:6379"environment:# 时区上海TZ: Asia/Shanghaivolumes:# 配置文件- /data/redis/conf:/redis/config# 数据文件- /data/redis/data/:/redis/data/command: "redis-server /redis/config/redis.conf"privileged: trueminio:image: minio/miniocontainer_name: minioports:# api 端口- "9000:9000"# 控制台端口- "9090:9090"environment:# 时区上海TZ: Asia/Shanghai# 管理后台用户名MINIO_ROOT_USER: minioadmin# 管理后台密码,最小8个字符MINIO_ROOT_PASSWORD: minioadminhfwy# https需要指定域名#MINIO_SERVER_URL: "https://xxx.com:9000"#MINIO_BROWSER_REDIRECT_URL: "https://xxx.com:9001"# 开启压缩 on 开启 off 关闭MINIO_COMPRESS: "off"# 扩展名 .pdf,.doc 为空 所有类型均压缩MINIO_COMPRESS_EXTENSIONS: ""# mime 类型 application/pdf 为空 所有类型均压缩MINIO_COMPRESS_MIME_TYPES: ""volumes:# 映射当前目录下的data目录至容器内/data目录- /data/minio/data:/data# 映射配置目录- /data/minio/config:/root/.minio/command: server --address ':9000' --console-address ':9090' /data# 指定容器中的目录 /dataprivileged: trueenergy-py:image: energy-py:1.0.0container_name: energy-pyrestart: alwaysbuild:context: ./pydockerfile: Dockerfilevolumes:# 映射当前目录下的data目录至容器内/data目录- /data/energy-py/config/config.json:/py/config.jsonenvironment:# 时区上海TZ: Asia/Shanghaiprivileged: truegateway:image: gateway:1.0.0container_name: gatewayenvironment:# 时区上海TZ: Asia/Shanghaiports:- "3212:3212"volumes:# 配置文件- /data/gateway/logs/:/data/gateway/logs# skywalking 探针- /data/skywalking/agent/:/skywalking/agentprivileged: truenetwork_mode: "host"speedcollect:image: speedcollect:1.0.0container_name: speedcollectenvironment:# 时区上海TZ: Asia/Shanghaiports:- "1234:1234"volumes:# 配置文件- /data/speedcollect/logs/:/speedcollect/logs# skywalking 探针- /data/skywalking/agent/:/skywalking/agentprivileged: truenetwork_mode: "host" ##################################################################################################################################### 以下为扩展根据需求搭建 ##########################################################################################################################################elasticsearch:image: elasticsearch:7.17.6container_name: elasticsearchports:- "9200:9200"- "9300:9300"environment:# 设置集群名称cluster.name: elasticsearch# 以单一节点模式启动discovery.type: single-nodeES_JAVA_OPTS: "-Xms512m -Xmx512m"volumes:- /data/elk/elasticsearch/plugins:/usr/share/elasticsearch/plugins- /data/elk/elasticsearch/data:/usr/share/elasticsearch/data- /data/elk/elasticsearch/logs:/usr/share/elasticsearch/logsnetwork_mode: "host"kibana:image: kibana:7.17.6container_name: kibanaports:- "5601:5601"depends_on:# kibana在elasticsearch启动之后再启动- elasticsearchenvironment:#设置系统语言文中文I18N_LOCALE: zh-CN# 访问域名# SERVER_PUBLICBASEURL: https://kibana.cloud.comvolumes:- /elk/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.ymlnetwork_mode: "host"logstash:image: logstash:7.17.6container_name: logstashports:- "4560:4560"volumes:- /elk/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf- /elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.ymldepends_on:- elasticsearchnetwork_mode: "host"mqnamesrv:image: apache/rocketmq:4.9.4container_name: mqnamesrvports:- "9876:9876"environment:JAVA_OPT: -server -Xms512m -Xmx512mcommand: sh mqnamesrvvolumes:- /rocketmq/namesrv/logs:/home/rocketmq/logs/rocketmqlogsnetwork_mode: "host"mqbroker1:image: apache/rocketmq:4.9.4container_name: mqbroker1ports:- "10911:10911"- "10909:10909"- "10912:10912"environment:JAVA_OPT_EXT: -server -Xms512M -Xmx512M -Xmn256mcommand: sh mqbroker -c /home/rocketmq/rocketmq-4.9.4/conf/broker.confdepends_on:- mqnamesrvvolumes:- /rocketmq/broker1/conf/broker.conf:/home/rocketmq/rocketmq-4.9.4/conf/broker.conf- /rocketmq/broker1/logs:/home/rocketmq/logs/rocketmqlogs- /rocketmq/broker1/store:/home/rocketmq/storenetwork_mode: "host"mqconsole:image: styletang/rocketmq-console-ngcontainer_name: mqconsoleports:- "19876:19876"environment:JAVA_OPTS: -Dserver.port=19876 -Drocketmq.namesrv.addr=127.0.0.1:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=falsedepends_on:- mqnamesrvnetwork_mode: "host"rabbitmq:image: rabbitmq:3.10.6container_name: rabbitmqbuild:context: ./rabbitmqenvironment:RABBITMQ_DEFAULT_USER: adminRABBITMQ_DEFAULT_PASS: 111111ports:- "25688:15672" # 管理界面端口- "25689:5672" # api 端口volumes:- /home/rabbitmq/log:/var/log/rabbitmq- /home/rabbitmq/data:/var/lib/rabbitmqzookeeper:image: 'bitnami/zookeeper:3.8.0'container_name: zookeeperports:- "2181:2181"environment:TZ: Asia/ShanghaiALLOW_ANONYMOUS_LOGIN: "yes"ZOO_SERVER_ID: 1ZOO_PORT_NUMBER: 2181# 自带的控制台 一般用不上可自行开启ZOO_ENABLE_ADMIN_SERVER: "no"# 自带控制台的端口ZOO_ADMIN_SERVER_PORT_NUMBER: 8080network_mode: "host"kafka:image: 'bitnami/kafka:3.2.0'container_name: kafkaports:- "9092:9092"environment:TZ: Asia/Shanghai# 更多变量 查看文档 https://github.com/bitnami/bitnami-kafka/blob/master/README.mdKAFKA_BROKER_ID: 1# 监听端口KAFKA_CFG_LISTENERS: PLAINTEXT://:9092# 实际访问ip 本地用 127 内网用 192 外网用 外网ipKAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://192.168.31.165:9092KAFKA_CFG_ZOOKEEPER_CONNECT: 127.0.0.1:2181ALLOW_PLAINTEXT_LISTENER: "yes"volumes:- /kafka/data:/bitnami/kafka/datadepends_on:- zookeepernetwork_mode: "host"kafka-manager:image: sheepkiller/kafka-manager:latestcontainer_name: kafka-managerports:- "19092:19092"environment:ZK_HOSTS: 127.0.0.1:2181APPLICATION_SECRET: letmeinKAFKA_MANAGER_USERNAME: energy-electrolysisKAFKA_MANAGER_PASSWORD: energyElectrolysis123KM_ARGS: -Dhttp.port=19092depends_on:- kafkanetwork_mode: "host"sky-oap:image: apache/skywalking-oap-server:9.3.0container_name: sky-oapports:- "11800:11800"- "12800:12800"environment:JAVA_OPTS: -Xms1G -Xmx2G#记录数据的有效期,单位天SW_CORE_RECORD_DATA_TTL: 7#分析指标数据的有效期,单位天SW_CORE_METRICS_DATA_TTL: 7SW_STORAGE: elasticsearchSW_STORAGE_ES_CLUSTER_NODES: 127.0.0.1:9200TZ: Asia/Shanghainetwork_mode: "host"sky-ui:image: apache/skywalking-ui:9.3.0container_name: sky-uiports:- "18080:18080"environment:SW_SERVER_PORT: 18080SW_OAP_ADDRESS: http://127.0.0.1:12800TZ: Asia/Shanghaidepends_on:- sky-oapnetwork_mode: "host"grafana:image: grafana/grafana:9.2.4container_name: grafanaenvironment:TZ: Asia/Shanghai# 服务地址 用于指定外网ip或域名GF_SERVER_ROOT_URL: ""# admin 管理员密码GF_SECURITY_ADMIN_PASSWORD: 123456ports:- "3000:3000"volumes:- /grafana/grafana.ini:/etc/grafana/grafana.ini- /grafana:/var/lib/grafananetwork_mode: "host"