docker_base_jdk/Dockerfile

21 lines
723 B
Docker
Raw Permalink Normal View History

2021-02-06 10:20:41 +08:00
FROM alpine:3.13 as build
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk --no-cache add openjdk9
RUN /usr/lib/jvm/default-jvm/bin/jlink \
--compress=2 \
--module-path /usr/lib/jvm/default-jvm/jmods \
--add-modules java.base,java.logging,java.xml,jdk.unsupported,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \
--output /jdk-minimal
WORKDIR /build
FROM alpine:3.13
# 设置时区为上海
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
COPY --from=build /jdk-minimal /opt/jdk/
ENV JAVA_HOME=/opt/jdk PATH="/opt/jdk/bin:$PATH"