ca42a7d9a4
- 删除分布式架构相关文件和配置 - 将backend-distributed重命名为backend保留分布式代码作为参考 - 优化backend-single单体架构实现 - 添加Coze API集成相关文档和测试 - 清理项目根目录的部署脚本和配置文件 - 更新WebSocket和消息服务实现 - 完善认证服务和密码加密功能
49 lines
1.1 KiB
Docker
49 lines
1.1 KiB
Docker
# 探索服务Dockerfile
|
|
FROM openjdk:17-jdk-alpine
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 安装必要的工具
|
|
RUN apk add --no-cache curl tzdata && \
|
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|
echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
# 复制Maven构建文件
|
|
COPY pom.xml ./
|
|
COPY emotion-common ./emotion-common
|
|
COPY emotion-explore ./emotion-explore
|
|
|
|
# 安装Maven
|
|
RUN apk add --no-cache maven
|
|
|
|
# 构建应用
|
|
RUN mvn clean package -DskipTests -pl emotion-explore -am
|
|
|
|
# 创建运行用户
|
|
RUN addgroup -g 1000 emotion && \
|
|
adduser -D -s /bin/sh -u 1000 -G emotion emotion
|
|
|
|
# 复制jar文件
|
|
RUN cp emotion-explore/target/emotion-explore-*.jar app.jar
|
|
|
|
# 设置文件权限
|
|
RUN chown -R emotion:emotion /app
|
|
|
|
# 切换到非root用户
|
|
USER emotion
|
|
|
|
# 健康检查
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:19005/actuator/health || exit 1
|
|
|
|
# 暴露端口
|
|
EXPOSE 19005
|
|
|
|
# 启动命令
|
|
ENTRYPOINT ["java", "-jar", \
|
|
"-Xms512m", "-Xmx1024m", \
|
|
"-Djava.security.egd=file:/dev/./urandom", \
|
|
"-Dspring.profiles.active=local", \
|
|
"app.jar"]
|