FROM bladex/alpine-java:openjdk17_cn_slim
ARG ACTIVE

LABEL maintainer="bladejava@qq.com"

# 设置时区为上海
ENV TZ=Asia/Shanghai
# 设置时区信息
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 创建 JVM GC 日志、堆转储和应用日志目录
RUN mkdir -p /opt/logs

COPY ./target/blade-openapi.jar /opt/app.jar

WORKDIR /opt

EXPOSE 8108

ENTRYPOINT ["/bin/sh", "-c", "exec java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -Djava.security.egd=file:/dev/./urandom -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/logs -XX:ErrorFile=/opt/logs/hs_err_pid%p.log '-Xlog:gc*:file=/opt/logs/gc.log:time,uptime,level,tags:filecount=5,filesize=50M' -XX:MaxDirectMemorySize=512m -Xms1024m -Xmx1024m -jar app.jar --spring.profiles.active=${ACTIVE:-prod} --logging.path=/opt/logs"]
