halo/Dockerfile
croatialu 2bcab942c1
chore: specify expose port in dockerfile (#5820)
#### What type of PR is this?
/kind improvement

#### What this PR does / why we need it:

When traefik is used, the host cannot be accessed to 8090 by default after being configured. Therefore, you need to configure loadbalance. The process is complicated, so specify the expose port

当使用 traefik 时, 配置完 host 后无法直接的访问到对应的服务, 需要额外的配置service, loadbalance.port 才能, 所以建议增加一个 expose port, 指定下默认的服务端口
#### Which issue(s) this PR fixes:


#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-04-29 10:37:26 +00:00

29 lines
925 B
Docker

FROM eclipse-temurin:21-jre as builder
WORKDIR application
ARG JAR_FILE=application/build/libs/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
################################
FROM ibm-semeru-runtimes:open-21-jre
LABEL maintainer="johnniang <johnniang@foxmail.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/ ./
ENV JVM_OPTS="-Xmx256m -Xms256m" \
HALO_WORK_DIR="/root/.halo2" \
SPRING_CONFIG_LOCATION="optional:classpath:/;optional:file:/root/.halo2/" \
TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone
Expose 8090
ENTRYPOINT ["sh", "-c", "java ${JVM_OPTS} org.springframework.boot.loader.launch.JarLauncher ${0} ${@}"]