# dockerfile 说明

# 基础镜像支持 x64 和 aarch64

# x64 镜像

  • registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/nginx:1.24.0
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/redis:6.2.14
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/mysql:5.7.43

# aarch64 镜像

  • registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8-arm
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-arm
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/nginx:1.24.0-arm
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/redis:6.2.14-arm
  • registry.cn-shanghai.aliyuncs.com/primeton-pub/mysql:5.7.43-arm

# 制作镜像

  • 查看当前系统架构
arch
  • 根据 CPU 架构选择对应镜像
# 使用 x64 架构
FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8

# 使用 aarch64 镜像, 请替换为镜像结尾`-arm`
FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8-arm
  • 本文当中使用 127.0.0.1 为示例 IP 地址,真实环境需要将 127.0.0.1 替换当前环境真实运行的 IP 地址

# 获取 redis 和 mysql 镜像

  • 运行 redis 镜像

加构 x64 命令如下

docker run -d --name redis -p 6379:6379 -v $PWD/data:/redisdata registry.cn-shanghai.aliyuncs.com/primeton-pub/redis:6.2.14 --appendonly yes --requirepass primeton

加构 aarch64 或 arm64 命令如下

docker run -d --name redis -p 6379:6379 -v $PWD/data:/redisdata registry.cn-shanghai.aliyuncs.com/primeton-pub/redis:6.2.14-arm --appendonly yes --requirepass primeton
  • 运行 MySQL 镜像

加构 x64 命令如下

docker run -d --name mysql -p 3306:3306 -v $PWD/mysqldata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=primeton registry.cn-shanghai.aliyuncs.com/primeton-pub/mysql:5.7.43 --lower-case-table-names=1 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci

加构 aarch64 或 arm64 命令如下

docker run -d --name mysql -p 3306:3306 -v $PWD/mysqldata:/bitnami/mysql/data -e MYSQL_ROOT_PASSWORD=primeton -e MYSQL_EXTRA_FLAGS='--lower-case-table-names=1' registry.cn-shanghai.aliyuncs.com/primeton-pub/mysql:5.7.43-arm

-e MYSQL_EXTRA_FLAGS='--lower-case-table-names=1'

# nacos 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="Nacos"
ENV NACOS_PORT=8848 NACOS_PKG=nacos-1.3.2-eos82.zip DATABASE_URL="" DATABASE_USER="" DATABASE_PASSWD=""
WORKDIR /app
ADD ${NACOS_PKG} .
RUN yum install unzip -y; yum clean all; unzip ${NACOS_PKG}; rm -f ${NACOS_PKG}
RUN sed -i "/db.url.0=.*$/cdb.url.0=\${DATABASE_URL}" conf/application.properties ;\
    sed -i "/db.user=.*$/cdb.user=\${DATABASE_USER}" conf/application.properties ;\
    sed -i "/db.password=.*$/cdb.password=\${DATABASE_PASSWD}" conf/application.properties ;\
    sed -i "/server.tomcat.accesslog.enabled=.*$/cserver.tomcat.accesslog.enabled=true" conf/application.properties ;\
    sed -i "/nohup.*$/c\$JAVA \${JAVA_OPT} nacos.nacos" bin/startup.sh
EXPOSE ${NACOS_PORT}
CMD ["bash","bin/startup.sh"]

构建镜像

  • 下载 nacos-1.3.2-eos82.zip
  • 创建 Dockerfile-NACOS
  • 构建 docker build -t nacos:8.2ga -f Dockerfile-NACOS .
  • 运行 nacos 镜像
docker run -d --name nacos \
  -e DATABASE_URL="jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC" \
  -e DATABASE_USER=root \
  -e DATABASE_PASSWD=primeton \
  -p 8848:8848 \
  nacos:8.2ga \

# gateway 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="Gateway"
ENV GATEWAY_PORT=9090 API_PKG=EOS_Platform_8.2GA_API_Gateway.tar.gz REDIS_IP="" REDIS_PORT="" REDIS_PASSWORD="" NACOS_URL=""
WORKDIR /app
ADD ${API_PKG} .
RUN chmod +x *.jar
RUN sed -i "/spring.redis.host=.*$/cspring.redis.host=\${REDIS_IP}" config/application.properties ;\
    sed -i "/spring.redis.port=.*$/cspring.redis.port=\${REDIS_PORT}" config/application.properties ;\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=\${REDIS_PASSWORD}" config/application.properties ;\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=\${NACOS_URL}" config/bootstrap.properties ;\
    sed -i "/spring.cloud.nacos.discovery.server-addr=.*$/cspring.cloud.nacos.discovery.server-addr=\${NACOS_URL}" config/application-nacos.properties
EXPOSE ${GATEWAY_PORT}
CMD ["bash","bin/startup.sh","run"]

构建镜像

  • 下载 EOS_Platform_8.2GA_API_Gateway.tar.gz
  • 创建 Dockerfile-API
  • 构建 docker build -t api:8.2ga -f Dockerfile-API .
  • 运行 gateway 镜像
docker run -d --name gateway \
  -e NACOS_URL=127.0.0.1:8848 \
  -e REDIS_IP=127.0.0.1 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=primeton \
  -e EOS_DAP_MEM_OPTS="-Xms512m -Xmx2048m -Xmn512m" \
  -p 9090:9090 \
  gateway:8.2ga

# afcenter 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="afc"
ENV AFC_PORT=28083 AFC_PKG=EOS_Platform_AFCenter_8.2.5.tar.gz \
    REDIS_IP="" REDIS_PORT="" REDIS_PASSWORD="" AFC_DATABASE_URL="" AFC_DATABASE_USER="" AFC_DATABASE_PASSWD="" NACOS_URL=""
WORKDIR /app
ADD ${AFC_PKG} .
RUN sed -i "69,76s/<configValue key=\"C3p0-Url\">.*/<configValue key=\"C3p0-Url\">\${AFC_DATABASE_URL}<\/configValue>/" config/AFCENTER/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-UserName\">.*/<configValue key=\"C3p0-UserName\">\${AFC_DATABASE_USER}<\/configValue>/" config/AFCENTER/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Password\">.*/<configValue key=\"C3p0-Password\">\${AFC_DATABASE_PASSWD}<\/configValue>/" config/AFCENTER/config/user-config.xml; \
    sed -i "/^export EOS_DAP_MEM_OPTS=/d" bin/startup.sh ;\
    sed -i "/spring.redis.host=.*$/cspring.redis.host=\${REDIS_IP}" config/application.properties ;\
    sed -i "/spring.redis.port=.*$/cspring.redis.port=\${REDIS_PORT}" config/application.properties ;\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=\${REDIS_PASSWORD}" config/application.properties ;\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=\${NACOS_URL}" config/bootstrap.properties ;\
    sed -i "/spring.cloud.nacos.discovery.server-addr.*$/cspring.cloud.nacos.discovery.server-addr=\${NACOS_URL}" config/application-nacos.properties
EXPOSE ${AFC_PORT}
CMD ["bash","bin/startup.sh","run"]

构建镜像

  • 下载 EOS_Platform_AFCenter_8.2.5.tar.gz
  • 创建 Dockerfile-AFC
  • 构建 docker build -t afc:8.2.5 -f Dockerfile-AFC .
  • 运行 afcenter 镜像
docker run -d --name afc \
  -e JAVA_OPTS="-server -DAFC_DATABASE_URL=jdbc:mysql://127.0.0.1:3306/afcenter4eos82?characterEncoding=utf8 -DAFC_DATABASE_USER=root -DAFC_DATABASE_PASSWD=primeton" \
  -e NACOS_URL=127.0.0.1:8848 \
  -e REDIS_IP=127.0.0.1 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=primeton \
  -p 28083:28083 \
  afc:8.2.5

# afcenter UI 的 dockerfile

FROM  registry.cn-shanghai.aliyuncs.com/primeton-pub/nginx:1.24.0
LABEL version="8.2GA" appName="AFCenterUI"
ENV WEB_PORT=80 MOBILE_PORT=81 AFCUI_PKG=EOS_Platform_AFCenter_UI_8.2.5.tar.gz MOBLIE_PKG=EOS_Platform_AFCenter_MOBILE_UI_8.2.5.tar.gz GATEWAY_URL="" AFC_URL=""
RUN mkdir -p /opt/{web,moblie}
ADD ${AFCUI_PKG} /opt/web
ADD ${MOBLIE_PKG} /opt/moblie

构建镜像

  • 下载 EOS_Platform_AFCenter_UI_8.2.5.tar.gz
  • 创建 Dockerfile-AFCUI
  • 构建 docker build -t afcui:8.2.5 -f Dockerfile-AFCUI .
  • 运行 afcenter UI 镜像
docker run -d --name afcui -e GATEWAY_URL=127.0.0.1:9090 -e AFC_URL=127.0.0.1:28083 -p 80:80 afcui:8.2.5

# bps 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="BPS"
ENV BPS_PORT=48084 BPS_PKG=EOS_Platform_BPS_Server_8.2.5.tar.gz BPS_DATABASE_URL="" BPS_DATABASE_USER="" BPS_DATABASE_PASSWD="" NACOS_URL=""
WORKDIR /app
ADD ${BPS_PKG} .
RUN chmod +x *.jar
RUN sed -i "69,76s/<configValue key=\"C3p0-Url\">.*/<configValue key=\"C3p0-Url\">\${BPS_DATABASE_URL}<\/configValue>/" config/BPS-SERVER/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-UserName\">.*/<configValue key=\"C3p0-UserName\">\${BPS_DATABASE_USER}<\/configValue>/" config/BPS-SERVER/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Password\">.*/<configValue key=\"C3p0-Password\">\${BPS_DATABASE_PASSWD}<\/configValue>/" config/BPS-SERVER/config/user-config.xml; \
    sed -i "/^export EOS_DAP_MEM_OPTS=/d" bin/startup.sh ;\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=\${NACOS_URL}" config/bootstrap.properties ;\
    sed -i "/spring.cloud.nacos.discovery.server-addr.*$/cspring.cloud.nacos.discovery.server-addr=\${NACOS_URL}" config/application-nacos.properties
EXPOSE ${BPS_PORT}
CMD ["bash","bin/startup.sh","run"]

构建镜像

  • 下载 EOS_Platform_BPS_Server_8.2.5.tar.gz
  • 创建 Dockerfile-BPS
  • 构建 docker build -t bps:8.2.5 -f Dockerfile-BPS .
  • 运行 bps 镜像
docker run -d --name bps-container \
  -e JAVA_OPTS="$JAVA_OPTS -server -DBPS_DATABASE_URL=jdbc:mysql://127.0.0.1:3306/bps4eos82?characterEncoding=utf8 -DBPS_DATABASE_USER=root -DBPS_DATABASE_PASSWD=primeton" \
  -e NACOS_URL=127.0.0.1:8848 \
  -p 48084:48084 bps:8.2.5

# governor 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="Governor"
ENV GOV_PORT=29898 GOV_PKG=EOS_Platform_8.2GA_Governor_Master.tar.gz GOVERNOR_DATABASE_URL="" GOVERNOR_DATABASE_USER="" GOVERNOR_DATABASE_PASSWD=""
WORKDIR /app
ADD ${GOV_PKG} .
RUN sed -i "/spring.datasource.url=.*$/cspring.datasource.url=\${GOVERNOR_DATABASE_URL}" config/application.properties ;\
    sed -i "/spring.datasource.username=.*$/cspring.datasource.username=\${GOVERNOR_DATABASE_USER}" config/application.properties ;\
    sed -i "/spring.datasource.password=.*$/cspring.datasource.password=\${GOVERNOR_DATABASE_PASSWD}" config/application.properties
EXPOSE ${GOV_PORT}
CMD ["bash","bin/startup.sh","run"]

构建镜像

  • 下载 EOS_Platform_8.2GA_Governor_Master.tar.gz
  • 创建 Dockerfile-GOV
  • 构建 docker build -t gov:8.2ga -f Dockerfile-GOV .
  • 运行 governor 镜像
docker run -d --name governor \
    -e GOVERNOR_DATABASE_URL=jdbc:mysql://127.0.0.1:3306/govdb?serverTimezone=GMT%2B8&characterEncoding=UTF-8 \
    -e GOVERNOR_DATABASE_USER=root \
    -e GOVERNOR_DATABASE_PASSWD=primeton \
    -p 29898:29898 \
    gov:8.2ga

# governor UI 的 dockerfile

FROM  registry.cn-shanghai.aliyuncs.com/primeton-pub/nginx:1.24.0
LABEL version="8.2GA" appName="AFCenterUI"
ENV WEB_PORT=80 GOVUI_PKG=EOS_Platform_8.2GA_Governor_UI.tar.gz GOV_MASTER_URL=""
WORKDIR /opt/web
ADD ${GOVUI_PKG} /opt/web

构建镜像

  • 下载 EOS_Platform_8.2GA_Governor_UI.tar.gz
  • 创建 Dockerfile-GOVUI
  • 构建 docker build -t govui:8.2ga -f Dockerfile-GOVUI .
  • 运行 governor UI 镜像
docker run -d --name govui -e GOV_MASTER_URL=127.0.0.1:29898 -p 80:80 govui:8.2ga

# workspace 的 dockerfile

FROM registry.cn-shanghai.aliyuncs.com/primeton-pub/rockylinux:8.8-jdk8
LABEL version="8.2GA" appName="Workspace"
ENV WS_PORT=28080 WS_PKG=EOS_Platform_8.2GA_Workspace.tar.gz \
    REDIS_IP="" REDIS_PORT="" REDIS_PASSWORD="" WORKSPACE_DATABASE_URL="" WORKSPACE_DATABASE_USER="" WORKSPACE_DATABASE_PASSWD="" NACOS_URL=""
WORKDIR /app
ADD ${WS_PKG} .
RUN sed -i "69,76s/<configValue key=\"C3p0-Url\">.*/<configValue key=\"C3p0-Url\">\${WORKSPACE_DATABASE_URL}<\/configValue>/" config/WORKSPACE/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-UserName\">.*/<configValue key=\"C3p0-UserName\">\${WORKSPACE_DATABASE_USER}<\/configValue>/" config/WORKSPACE/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Password\">.*/<configValue key=\"C3p0-Password\">\${WORKSPACE_DATABASE_PASSWD}<\/configValue>/" config/WORKSPACE/config/user-config.xml; \
    sed -i "/^export EOS_DAP_MEM_OPTS=/d" bin/startup.sh ;\
    sed -i "/eos.cache.mode=.*$/ceos.cache.mode=map" config/application.properties ;\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=\${NACOS_URL}" config/bootstrap.properties ;\
    sed -i "/spring.cloud.nacos.discovery.server-addr.*$/cspring.cloud.nacos.discovery.server-addr=\${NACOS_URL}" config/application-nacos.properties
RUN sed -i "/export JAVA_OPTS=\"-server.*/cexport JAVA_OPTS=\"\$JAVA_OPTS -server -Djava.net.preferIPv4Stack=true -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom\"" bin/startup.sh
EXPOSE ${WS_PORT}
CMD ["bash","bin/startup.sh","run"]

构建镜像

  • 下载 EOS_Platform_8.2GA_Workspace.tar.gz
  • 创建 Dockerfile-WS
  • 构建 docker build -t ws:8.2ga -f Dockerfile-WS .
  • 运行 workspace 镜像
docker run -d --name workspace \
    -e JAVA_OPTS="-server -DWORKSPACE_DATABASE_URL=jdbc:mysql://127.0.0.1:3306/afcenter4eos82?characterEncoding=utf8 -DWORKSPACE_DATABASE_USER=root -DWORKSPACE_DATABASE_PASSWD=primeton" \
    -e NACOS_URL=127.0.0.1:8848 \
    -p 28080:28080 \
    ws:8.2ga

# workspace UI 的 dockerfile

FROM  registry.cn-shanghai.aliyuncs.com/primeton-pub/nginx:1.24.0
LABEL version="8.2GA" appName="AFCenterUI"
ENV WEB_PORT=80 WSUI_PKG=EOS_Platform_8.2GA_Workspace_UI.tar.gz WS_SERVER=""
WORKDIR /opt/web
ADD ${WSUI_PKG} /opt/web

构建镜像

  • 下载 EOS_Platform_8.2GA_Workspace_UI.tar.gz
  • 创建 Dockerfile-WSUI
  • 构建 docker build -t wsui:8.2ga -f Dockerfile-WSUI .
  • 运行 workspace UI 镜像
docker run -d --name wsui -p 80:80 -e WS_SERVER=127.0.0.1:28080 wsui:8.2ga
上次更新: 2023/11/10上午9:08:12