Files
mp-java/Dockerfile
赵忠林 7ec7522357 feat(wx): 添加微信小程序码生成功能
- 新增 getQRCodeUnlimited 方法生成小程序码
- 添加 getLocalAccessToken 方法获取微信 access_token
- 更新 WxLoginController 以使用新的二维码生成逻辑- 移除 MqttServiceTest 类,增加 WxDev 类用于微信相关测试
- 更新 Dockerfile 和 docker-compose.yml 以适应新的功能需求
2025-08-21 10:21:31 +08:00

42 lines
974 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用更小的 Alpine Linux + OpenJDK 17 镜像
FROM openjdk:17-jdk-alpine
# 设置工作目录
WORKDIR /app
# 创建日志目录
RUN mkdir -p /app/logs
# 创建上传文件目录
RUN mkdir -p /app/uploads
# 安装wget用于健康检查并添加应用用户安全考虑
RUN apk add --no-cache wget && \
addgroup -g 1000 appgroup && \
adduser -D -u 1000 -G appgroup appuser
# 复制jar包到容器
COPY target/*.jar app.jar
# 设置目录权限
RUN chown -R appuser:appgroup /app
# 切换到应用用户
USER appuser
# 暴露端口
EXPOSE 9200
# 设置JVM参数
ENV JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom"
# 设置Spring Profile
ENV SPRING_PROFILES_ACTIVE=prod
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:9200/actuator/health || exit 1
# 启动应用
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]