ARG BASE_IMAGE=172.16.46.66:10043/base-service/skywalking-agent-jre:9.7.0
FROM ${BASE_IMAGE}

# 设置应用目录
RUN mkdir -p /app
WORKDIR /app

# 复制应用文件
COPY target/base-server.jar app.jar

# 设置环境变量
ENV TZ=Asia/Shanghai
ENV JAVA_OPTS="-Xms512m -Xmx512m"
ENV SW_AGENT_HOME=/opt/skywalking/agent
ENV SW_AGENT_NAME=base-server
ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES=172.16.46.63:30201
ENV AGENT_JAVA_OPTS="-javaagent:${SW_AGENT_HOME}/skywalking-agent.jar -Dskywalking.agent.service_name=${SW_AGENT_NAME} -Dskywalking.collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES}"

# 暴露端口
EXPOSE 48200

# 运行应用
CMD java ${AGENT_JAVA_OPTS} ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
