# 使用基础镜像
FROM golang:1.21.3 as builder

# 设置工作目录并指定构建模块
WORKDIR /app
ARG MODULE

# 复制必要文件
COPY $MODULE/target/xJarDir .

RUN go mod init . && \
    go mod tidy && \
    go build -o . xjar.go
#
## 创建容器镜像
#FROM openjdk:21-jdk
#
#ARG ACTIVE
#
## 定义镜像元数据和环境变量
#LABEL maintainer="shenyifei <809745357@qq.com>"
#LABEL version="1.0.0"
#ENV HOME "/app"
#ENV TZ "Asia/Shanghai"
#ENV LANG "C.UTF-8"
#ENV XMS "500m"
#ENV XMX "2g"
#ENV XSS "256k"
#ENV GC_MODE "G1"
#ENV USE_GC_LOG "Y"
#ENV USE_HEAP_DUMP "Y"
#ENV USE_LARGE_PAGES "N"
#ENV SPRING_PROFILES_ACTIVE ${ACTIVE}
#ENV SERVER_PORT "8080"
#ENV MANAGEMENT_SERVER_PORT "9080"
#ENV NACOS_SERVER_ADDR "nacos-headless:8848"
#
#WORKDIR $HOME
#
#RUN chmod +x entrypoint.sh
#
#RUN mkdir $HOME/logs \
#  && touch $HOME/logs/entrypoint.out \
#  && ln -sf /dev/stdout $HOME/logs/entrypoint.out \
#  && ln -sf /dev/stderr $HOME/logs/entrypoint.out
#
## 设置启动入口和端口
#EXPOSE $SERVER_PORT $MANAGEMENT_SERVER_PORT
#ENTRYPOINT ["./entrypoint.sh"]
