Files
JChargePointProtocol/docker/app.Dockerfile
2025-07-15 17:48:56 +08:00

47 lines
1.4 KiB
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.
#
# 开源代码,仅供学习和交流研究使用,商用请联系三丙
# 微信mohan_88888
# 抖音:程序员三丙
# 付费课程知识星球https://t.zsxq.com/aKtXo
#
FROM registry.cn-hangzhou.aliyuncs.com/sanbing/jcpp-base:1.0 AS base
WORKDIR /app
COPY . .
RUN mvn -U -B -T 0.8C clean install -DskipTests
#分层
FROM registry.cn-hangzhou.aliyuncs.com/sanbing/openjdk:21-bullseye AS builder
WORKDIR /app
COPY --from=base /app/jcpp-app-bootstrap/target/application.jar application.jar
RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted
# 执行
FROM registry.cn-hangzhou.aliyuncs.com/sanbing/openjdk:21-bullseye
RUN useradd -m sanbing
WORKDIR /home/sanbing
COPY --from=builder /app/extracted/dependencies/ ./
COPY --from=builder /app/extracted/spring-boot-loader/ ./
COPY --from=builder /app/extracted/snapshot-dependencies/ ./
COPY --from=builder /app/extracted/application/ ./
COPY --from=base /app/jcpp-app-bootstrap/target/conf ./config
COPY --from=base /app/docker/start.sh .
RUN chmod a+x start.sh \
&& mkdir -p /home/sanbing/logs/jcpp \
&& mkdir -p /home/sanbing/logs/accesslog \
&& mkdir -p /home/sanbing/logs/gc \
&& mkdir -p /home/sanbing/logs/heapdump \
&& chmod 700 -R /home/sanbing/logs/* \
&& chown -R sanbing:sanbing /home/sanbing
EXPOSE 8080 8080
ENV APP_LOG_LEVEL=INFO
ENV PROTOCOLS_LOG_LEVEL=INFO
USER sanbing
CMD ["/bin/bash", "start.sh"]