Alpine镜像
修改repositories
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
修改时区
apk add tzdata
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo Asia/Shanghai > /etc/timezone
apk del tzdata
示例
FROM test.com/base/openjdk:8-jdk-alpine
ENV WORKSPACE=/app TZ=Asia/Shanghai
CMD mkdir ${WORKSPACE}
WORKDIR ${WORKSPACE}
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk --update add --no-cache ttf-dejavu fontconfig tzdata tini curl bash wget busybox-extras bind-tools tcpdump net-tools && \
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo ${TZ} > /etc/timezone && \
rm -rf /var/cache/apk/*
COPY app.jar app.jar
EXPOSE 8080
CMD /sbin/tini -- java -Djava.security.egd=file:/dev/./urandom ${SW_AGENT_OPTS} ${JAVA_OPTS} -jar /app/app.jar ${SPRING_OPTS}