基础JDK镜像
openjdk:8-jdk-alpine
- 修改apk包管理为国内镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositorie \
&& apk update
- 修改时区为国内
ENV TZ Asia/Shanghai
RUN apk add tzdata && cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& apk del tzdata
- Alpine镜像缺少字体的问题
RUN apk add --update tzdata busybox-extras fontconfig ttf-dejavu
- 删除相关依赖
RUN rm -fr /var/cache/apk/*
完整版Dockerfile
FROM openjdk:8-jdk-alpine
MAINTAINER QINGYAN
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositorie \
&& apk update
ENV TZ Asia/Shanghai
RUN apk add tzdata && cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& apk del tzdata
RUN apk add --update tzdata busybox-extras fontconfig ttf-dejavu
RUN rm -fr /var/cache/apk/*
镜像已上传到aliyun仓库:registry.cn-hangzhou.aliyuncs.com/qingyan/openjdk:8-alpine