# =============================================
# Print Service Dockerfile
# =============================================

FROM openjdk:17-slim

# 安装必要工具
RUN apt-get update && apt-get install -y \
    curl \
    && rm -rf /var/lib/apt/lists/*

# 创建工作目录
WORKDIR /app

# 复制jar包
COPY target/print-service-1.0.0-SNAPSHOT.jar /app/print-service.jar

# 复制配置文件
COPY src/main/resources/application.yml /app/config/application.yml
COPY src/main/resources/bootstrap.yml /app/config/bootstrap.yml

# 设置环境变量
ENV JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC"

# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
    CMD curl -f http://localhost:8089/actuator/health || exit 1

# 暴露端口
EXPOSE 8089

# 启动命令
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/print-service.jar"]
