blank的编程之路


  • 首页

  • 归档

  • 搜索
consul atomikos mybatisplus druid nexus nas named bind mysqldump acme.sh Dockerfile rsync keepalived swarm kibana ubuntu linux scp bugfix https ssl certbot curl gogs adminer harbor yum portainer python kubernetes idea java springboot maven docker-compose redis nginx mysql brew git chocolatey jenkins elasticsearch docker haproxy rabbitmq centos

docker 自制基于 centos7 的 中文支持带 openjdk 运行环境的底包 Dockerfile

发表于 2019-11-22 | 分类于 运维 | 0 | 阅读次数 535

创建 Dockerfile

mkdir -p /docker/dockerfile/centos7

cat > /docker/dockerfile/centos7/Dockerfile <<EOF
FROM centos:7
MAINTAINER blankhang <[email protected]>
LABEL version='1.0' description='centos7 with chinese lanugage and jdk8 and CST GMT+8 timezone support'

RUN yum install -y libXmu freetype kde-l10n-Chinese fontconfig && \
yum -y reinstall glibc-common && \
yum groupinstall "fonts" -y && fc-cache -fv && \
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && \
yum install -y java-1.8.0-openjdk.x86_64 && \
yum clean all && rm -rf /var/cache/yum/*
EOF
创建构建推送镜像到私服脚本

可将 registry.aliyuncs.com/test/ 修改为你自己的私服地址

cat > /docker/dockerfile/centos7/build-and-push.sh << \EOF
#!/bin/bash

IMAGE_NAME=registry.aliyuncs.com/test/centos7-openjdk8

docker build -t ${IMAGE_NAME} .
docker push ${IMAGE_NAME}
EOF

# 脚本授权
chmod +x /docker/dockerfile/centos7/build-and-push.sh 

执行脚本 将会自动构建并推送镜像到私服

sh /docker/dockerfile/centos7/build-and-push.sh

然后 项目的 Dockerfile 就可以直接引用此包底了

节省大量的重复的底包构建时间

FROM registry.aliyuncs.com/test/centos7-openjdk8:latest
  • 本文作者: blank
  • 本文链接: https://blankhang.com/2019/11/22/201911221151
  • 版权声明: 本博客所有文章除特别声明外,均采用CC BY-NC-SA 3.0 许可协议。转载请注明出处!
# consul # atomikos # mybatisplus # druid # nexus # nas # named # bind # mysqldump # acme.sh # Dockerfile # rsync # keepalived # swarm # kibana # ubuntu # linux # scp # bugfix # https # ssl # certbot # curl # gogs # adminer # harbor # yum # portainer # python # kubernetes # idea # java # springboot # maven # docker-compose # redis # nginx # mysql # brew # git # chocolatey # jenkins # elasticsearch # docker # haproxy # rabbitmq # centos
POST 请求 被 nginx 301 后 变 GET
docker nginx 利用阿里 key secret 配置泛域名证书
© 2023 blank
Everything is energy and everything has a frequency