Files
myvindata/Dockerfile
2026-04-28 16:21:46 +08:00

26 lines
728 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.

# 构建阶段Maven + JDK17 打包
FROM maven:3.8.8-openjdk-17-slim AS builder
WORKDIR /app
COPY pom.xml .
COPY src ./src
RUN mvn clean package -DskipTests
# 运行阶段:轻量 JRE17 镜像
FROM eclipse-temurin:17-jre-alpine
# 设置上海时区和你Python代码时间一致
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
# 复制打好的jar
COPY --from=builder /app/target/*.jar app.jar
EXPOSE 8080
#ENTRYPOINT ["java", "-jar", "app.jar"]
CMD ["java", \
"--add-opens", "java.base/java.nio=ALL-UNNAMED", \
"--add-opens", "java.base/sun.misc=ALL-UNNAMED", \
"-Dio.netty.tryUnsafe=false", \
"-jar", "app.jar"]