# ============================================================
# GBS Java Application Dockerfile Template
# Based on: CentOS 7 + Oracle JDK 1.8.0_202
# Usage: docker build -t <image-name>:<tag> -f Dockerfile .
# ============================================================
# Build context structure:
#   .
#   ├── Dockerfile
#   ├── jdk1.8.0_202/     (JDK directory, copied from /opt/jdk1.8.0_202)
#   └── target/
#       └── *.jar         (application JAR file)
# ============================================================

FROM centos:7

# Set timezone to Asia/Shanghai
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# Copy JDK
COPY jdk1.8.0_202/ /opt/jdk1.8.0_202/

# Set Java environment variables
ENV JAVA_HOME=/opt/jdk1.8.0_202
ENV PATH=$PATH:$JAVA_HOME/bin
ENV LANG=C.UTF-8

# Create log directory
RUN mkdir -p /opt/logs

# Copy the built JAR file
COPY target/*.jar /opt/app.jar

# Default entrypoint
# Runtime parameters can be overridden via K8s deployment or 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"]
