# ============================================================
# GBS Java Application Dockerfile 模板 (CentOS 7 + JDK 1.8.0_202)
# 适用于没有项目自带 Dockerfile 的场景，通过本地 JDK 打包
# ============================================================
# Build context 目录结构:
#   .
#   ├── Dockerfile
#   ├── jdk1.8.0_202/     (从主节点 /opt/jdk1.8.0_202 复制)
#   └── target/
#       └── *.jar         (应用 JAR 文件)
# ============================================================

FROM centos:7

# 设置时区为 Asia/Shanghai
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# 复制 JDK
COPY jdk1.8.0_202/ /opt/jdk1.8.0_202/

# 设置 Java 环境变量
ENV JAVA_HOME=/opt/jdk1.8.0_202
ENV PATH=$PATH:$JAVA_HOME/bin
ENV LANG=C.UTF-8

# 创建日志目录
RUN mkdir -p /opt/logs

# 复制 JAR 文件
COPY target/*.jar /opt/app.jar

# 启动参数 (可通过 K8s deployment 或 docker run -e 覆盖)
ENTRYPOINT ["/opt/jdk1.8.0_202/bin/java", \
    "-Dnacos.namespace=jjb-dragon", \
    "-Dnacos.url=prod-nacos:8848", \
    "-Dspring.profiles.active=prod", \
    "-Dmysql.password=Mysql@zcloud33080", \
    "-Dmysql.host=192.168.20.100", \
    "-Dmysql.port=33080", \
    "-Dmysql.username=root", \
    "-jar", "/opt/app.jar"]
