#FROM bellsoft/liberica-openjdk-debian:17 AS build
FROM registry.cn-shanghai.aliyuncs.com/physical/maven:3.9.8-eclipse-temurin-17 AS build

WORKDIR /app
RUN rm -rf /root/.m2/settings.xml
COPY settings.xml /root/.m2/settings.xml

#ADD pom.xml /app
#RUN mvn verify --fail-never

ADD . /app
#RUN mvn dependency:go-offline

# RUN --mount=type=cache,target=/root/.m2   mvn package -DskipTests=true clean install
RUN --mount=type=cache,target=/root/.m2 mvn -P dev,jeecg,github  -DskipTests=true clean install


#FROM bellsoft/liberica-openjdk-debian:17
#FROM registry.cn-shanghai.aliyuncs.com/physical/liberica-openjdk-debian:17

#FROM bellsoft/liberica-openjdk-alpine:17
FROM registry.cn-shanghai.aliyuncs.com/physical/liberica-openjdk-alpine:17

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /app

EXPOSE 8080
#ADD ./src/main/resources/jeecg ./config/jeecg
COPY --from=build /app/physical-launcher/target/physical-launcher-3.7.0.jar physical-launcher-3.7.0.jar
COPY --from=build /app/templates ./templates
ENV PROFILE=dev

CMD sleep 10;java -Djava.security.egd=file:/dev/./urandom -jar physical-launcher-3.7.0.jar --spring.profiles.active=${PROFILE}