halo/Dockerfile

26 lines
888 B
Docker
Raw Normal View History

2022-07-12 03:01:00 +00:00
FROM eclipse-temurin:17-jre as builder
WORKDIR application
Refactor project structure for a better development (#3552) #### What type of PR is this? /kind cleanup /area core #### What this PR does / why we need it: This PR totally refactor project structure for a better plugin development. Now we can maintain and publish api and platform modules at Halo application side, which will be references by plugins. Currently, we can execute command `./gradlew clean publish` to publish api and platform modules into **local** Maven repository, so that we can refer these dependencies (`run.halo.tools.platform:plugin:2.4.0-SNAPSHOT` and `run.halo.app:api:2.4.0-SNAPSHOT`) in plugin projects. I will make another pull request to publish api library and platforms into Maven central repository. **Modules explanation**: - API module contains common classes which might be used by plugins. - Plugin Platform module contains dependency declarations of other plugin API modules. - Application Platform module contains dependency declarations application module might uses. If we want to build application only(exclude check and jar), we have to execute the command below: ```bash ./gradlew clean :application:build -x :application:check -x :application:jar ``` The executable Jar will be generated at folder `application/build/libs/`. If we want to build a Docker image, we could execute the command below: ```bash docker build -t johnniang/halo:project-structure . # Test the Docker image docker run -it --rm -p8090:8090 johnniang/halo:project-structure ``` #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/2730 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 重构项目结构 ```
2023-03-23 08:02:33 +00:00
ARG JAR_FILE=application/build/libs/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
2018-10-17 22:04:06 +00:00
################################
2022-07-12 03:01:00 +00:00
FROM eclipse-temurin:17-jre
MAINTAINER johnniang <johnniang@fastmail.com>
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
2018-10-17 22:04:06 +00:00
2022-07-12 03:01:00 +00:00
ENV JVM_OPTS="-Xmx256m -Xms256m" \
HALO_WORK_DIR="/root/.halo2" \
SPRING_CONFIG_LOCATION="optional:classpath:/;optional:file:/root/.halo2/" \
TZ=Asia/Shanghai
2018-10-17 22:04:06 +00:00
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone
2019-05-07 09:27:49 +00:00
ENTRYPOINT ["sh", "-c", "java ${JVM_OPTS} org.springframework.boot.loader.JarLauncher ${0} ${@}"]